Submission #3207310
Source Code Expand
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#include<bitset>
#define int long long
#define ll long long
#define mod 1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
int n;cin>>n;
int x[214514],y[214514];
int maxi=-1,mini=inf;
int ymax=-1,xmin=inf;
rep(i,0,n){
cin>>x[i]>>y[i];
if(x[i]<y[i])swap(x[i],y[i]);
ymax=max(y[i],ymax);xmin=min(xmin,x[i]);
maxi=max({maxi,x[i],y[i]});mini=min({mini,x[i],y[i]});
}
int t=(maxi-xmin)*(ymax-mini);
P num[214514];
rep(i,0,n){
swap(x[i],y[i]);
num[i]=P(x[i],y[i]);
}
sort(num,num+n);
vector<int>v;
rep(i,0,n){
if(i)v.push_back(x[i]);
}
v.insert(lower_bound(v.begin(),v.end(),y[0]),y[0]);
sort(v.begin(),v.end());
int di=v[n-1]-v[0];
rep(i,1,n-1){
v.erase(lower_bound(v.begin(),v.end(),x[i]));
v.insert(lower_bound(v.begin(),v.end(),y[i]),y[i]);
di=min(di,v[n-1]-v[0]);
}
cout<<min(t,di*(maxi-mini))<<endl;return 0;
}
Submission Info
Submission Time |
|
Task |
E - Ball Coloring |
User |
birdway |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1504 Byte |
Status |
WA |
Exec Time |
2104 ms |
Memory |
9076 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 700 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example0, example1, example2 |
All |
div20, div21, div22, div23, div24, example0, example1, example2, maxrand0, maxrand1, maxrand2, maxrand20, maxrand21, maxrand210, maxrand211, maxrand22, maxrand23, maxrand24, maxrand25, maxrand26, maxrand27, maxrand28, maxrand29, maxrand3, maxrand4, smallrand0, smallrand1, smallrand2, smallrand3, smallrand4, sparse0, sparse1, sparse2, sparse3, sparse4 |
Case Name |
Status |
Exec Time |
Memory |
div20 |
TLE |
2104 ms |
9076 KB |
div21 |
TLE |
2103 ms |
9076 KB |
div22 |
TLE |
2103 ms |
9076 KB |
div23 |
TLE |
2104 ms |
9076 KB |
div24 |
TLE |
2104 ms |
9076 KB |
example0 |
AC |
3 ms |
6656 KB |
example1 |
AC |
2 ms |
6656 KB |
example2 |
AC |
2 ms |
5376 KB |
maxrand0 |
TLE |
2104 ms |
9076 KB |
maxrand1 |
TLE |
2103 ms |
9076 KB |
maxrand2 |
TLE |
2104 ms |
9076 KB |
maxrand20 |
TLE |
2104 ms |
9076 KB |
maxrand21 |
TLE |
2104 ms |
9076 KB |
maxrand210 |
TLE |
2103 ms |
9076 KB |
maxrand211 |
TLE |
2104 ms |
9076 KB |
maxrand22 |
TLE |
2104 ms |
9076 KB |
maxrand23 |
TLE |
2104 ms |
9076 KB |
maxrand24 |
TLE |
2103 ms |
9076 KB |
maxrand25 |
TLE |
2104 ms |
9076 KB |
maxrand26 |
TLE |
2104 ms |
9076 KB |
maxrand27 |
TLE |
2104 ms |
9076 KB |
maxrand28 |
TLE |
2103 ms |
9076 KB |
maxrand29 |
TLE |
2104 ms |
9076 KB |
maxrand3 |
TLE |
2104 ms |
9076 KB |
maxrand4 |
TLE |
2103 ms |
9076 KB |
smallrand0 |
AC |
3 ms |
6016 KB |
smallrand1 |
WA |
2 ms |
5120 KB |
smallrand2 |
WA |
3 ms |
6528 KB |
smallrand3 |
WA |
2 ms |
6528 KB |
smallrand4 |
WA |
2 ms |
5760 KB |
sparse0 |
TLE |
2104 ms |
9076 KB |
sparse1 |
TLE |
2104 ms |
9076 KB |
sparse2 |
TLE |
2104 ms |
9076 KB |
sparse3 |
TLE |
2104 ms |
9076 KB |
sparse4 |
TLE |
2104 ms |
9076 KB |