oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

blanket Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

blanket.html

Problem Description

The spotlight is back on the Jiahai Potato Farm (JPF) again! The potatoes are all happy with their new WiFi connection and all of a sudden, one of them discovers terrible news! A hurricane is heading in their direction, and there's very little time to take cover! One of them immediately informs Jiahai, and Jiahai is now forced to take measures.

Being an incredibly intelligent farmer, Jiahai has decided to buy a huge blanket that can be used to cover all the potatoes and protect them from the hurricane winds. Given the X and Y coordinates of all the potatoes on the Jiahai Potato Farm, determine the minimum size of the blanket required to cover all the potatoes. The edges of the blanket must be parallel to the X and Y axes and follow along the integer gridlines. NOTE: A potato at a corner of the blanket is considered to be covered.

One possible configuration of JPF is given as follows:

In this case, the blanket will be from (5, 5) to (26, 17), covering an area of 252 units.

There will be N potatoes in JPF. You will be given N and two arrays, X[] and Y[]. (X[0], Y[0]) will be the coordinates of the first potato, (X[1], Y[1]) will be the coordinates of the second potato, etc.

Your program will be required to implement the following functions:

  1. long long int blanketSize(int N, int X[], int Y[]), which should return the minimum blanket size needed.

Limits

Subtask 1 (34%): 1 <= N, X[i], Y[i] <= 1 000
Subtask 2 (66%): 1 <= N, X[i], Y[i] <= 1 000 000

Sample Input 1

4
5 5
14 9
26 13
12 17

Sample Output 1

252

Drawing1.png

Tags

Ad Hoc

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
134501s32MBMinimum
266501s32MBMinimum
3011s32MBMinimum

Attachments

Attachment Filesize Last Updated
grader.cpp292B8 Aug 2013, 14:47:52
ans.cpp99B8 Aug 2013, 14:33:07
blanket.h74B8 Aug 2013, 14:32:14

Judge Compile Command

g++-8 grader.cpp ans.cpp -o blanket -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.