Submission #1694008


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long  LL;
struct node{int x,y;}a[200010];
int n;
LL ans;
set <int> S1,S2;

bool cmp(node x,node y){return x.x<y.x;}

void work()
{
	scanf("%d",&n);
	if (n==1)  {puts("0");  return;}
	for (int i=1; i<=n; i++)
		{
			scanf("%d %d",&a[i].x,&a[i].y);
			if (a[i].x>a[i].y)  swap(a[i].x,a[i].y);
			S1.insert(a[i].x),S2.insert(a[i].y);			
		}
	ans=1LL*(*S1.rbegin()-*S1.begin())*(*S2.rbegin()-*S2.begin());
	sort(a+1,a+n+1,cmp);
	for (int i=1; i<=n; i++)
		{
			S1.erase(S1.find(a[i].x)),S1.insert(a[i].y);
			S2.erase(S2.find(a[i].y)),S2.insert(a[i].x);
			ans=min(ans,1LL*(*S1.rbegin()-*S1.begin())*(*S2.rbegin()-*S2.begin()));
		}
	printf("%lld",ans);
}

int main()
{
	work();
	return 0;
}

Submission Info

Submission Time
Task E - Ball Coloring
User YMDragon
Language C++14 (GCC 5.4.1)
Score 0
Code Size 785 Byte
Status RE
Exec Time 339 ms
Memory 20608 KB

Compile Error

./Main.cpp: In function ‘void work()’:
./Main.cpp:14:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp:18:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d %d",&a[i].x,&a[i].y);
                                  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 3
AC × 3
RE × 32
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 RE 339 ms 20480 KB
div21 RE 330 ms 20480 KB
div22 RE 331 ms 20608 KB
div23 RE 329 ms 20608 KB
div24 RE 321 ms 20480 KB
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
maxrand0 RE 329 ms 20608 KB
maxrand1 RE 332 ms 20608 KB
maxrand2 RE 324 ms 20608 KB
maxrand20 RE 228 ms 11136 KB
maxrand21 RE 232 ms 11136 KB
maxrand210 RE 221 ms 11136 KB
maxrand211 RE 232 ms 11136 KB
maxrand22 RE 235 ms 11136 KB
maxrand23 RE 252 ms 11264 KB
maxrand24 RE 310 ms 16256 KB
maxrand25 RE 227 ms 11136 KB
maxrand26 RE 229 ms 11136 KB
maxrand27 RE 256 ms 11264 KB
maxrand28 RE 276 ms 11904 KB
maxrand29 RE 302 ms 15872 KB
maxrand3 RE 336 ms 20608 KB
maxrand4 RE 319 ms 20608 KB
smallrand0 RE 99 ms 256 KB
smallrand1 RE 97 ms 256 KB
smallrand2 RE 97 ms 256 KB
smallrand3 RE 96 ms 256 KB
smallrand4 RE 97 ms 256 KB
sparse0 RE 166 ms 1792 KB
sparse1 RE 166 ms 1792 KB
sparse2 RE 166 ms 1792 KB
sparse3 RE 168 ms 1792 KB
sparse4 RE 166 ms 1792 KB