Submission #351994

# Submission time Handle Problem Language Result Execution time Memory
351994 2021-01-20T10:45:22 Z Kerim Shortcut (IOI16_shortcut) C++17
0 / 100
2 ms 492 KB
#include "shortcut.h"
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<ll,ll> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const ll BIG=1e18;
vector<ll>x;
vector<int>d;
int n;
ll cost;
set<ll>a,b;
bool ok(ll k){	
	ll A=-BIG,B=BIG,C=-BIG,D=BIG,xx,yy;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++){
			xx=x[i]+x[j],yy=x[j]-x[i];
			if(d[i]+d[j]+x[j]-x[i]<=k)
				continue;
			ll val=k-d[i]-d[j]-cost;
			if(val<0)return 0;
			umax(C,yy-val);umin(D,yy+val);
			umax(A,xx-val);umin(B,xx+val);
		}
	if(A>B or C>D)return 0;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++){
			xx=x[i]+x[j],yy=x[j]-x[i];	
			if(A<=xx and xx<=B and C<=yy and yy<=D)
				return 1;
		}
	return 0;
}
long long find_shortcut(int N,vector<int> l,vector<int>D, int c){
	d=D;cost=c;n=N;x.resize(n);for(int i=0;i<n;i++)x[i]=0;
	for(int i=0;i<n-1;i++)
		x[i+1]=x[i]+l[i];
	ll st=0,en=ll(1e10);
	while(st+1<en){
		ll mid=(st+en)>>1;
		if(ok(mid))
			en=mid;
		else
			st=mid;
	}
	if(ok(st))return st;
	return en;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB n = 4, 80 is a correct answer
2 Correct 1 ms 364 KB n = 9, 110 is a correct answer
3 Correct 0 ms 364 KB n = 4, 21 is a correct answer
4 Correct 0 ms 364 KB n = 3, 4 is a correct answer
5 Correct 0 ms 364 KB n = 2, 62 is a correct answer
6 Correct 1 ms 364 KB n = 2, 3 is a correct answer
7 Correct 1 ms 364 KB n = 3, 29 is a correct answer
8 Correct 0 ms 364 KB n = 2, 3 is a correct answer
9 Correct 1 ms 364 KB n = 2, 3 is a correct answer
10 Correct 1 ms 364 KB n = 2, 2000000001 is a correct answer
11 Correct 0 ms 364 KB n = 2, 3000000000 is a correct answer
12 Correct 1 ms 364 KB n = 3, 3000000000 is a correct answer
13 Correct 0 ms 364 KB n = 3, 3000000000 is a correct answer
14 Correct 0 ms 364 KB n = 4, 3000000001 is a correct answer
15 Correct 0 ms 364 KB n = 4, 4000000000 is a correct answer
16 Correct 1 ms 364 KB n = 5, 4000000000 is a correct answer
17 Correct 0 ms 364 KB n = 10, 1000000343 is a correct answer
18 Correct 1 ms 492 KB n = 10, 3189 is a correct answer
19 Correct 0 ms 364 KB n = 10, 7000000000 is a correct answer
20 Correct 0 ms 364 KB n = 5, 12 is a correct answer
21 Correct 0 ms 364 KB n = 5, 25 is a correct answer
22 Correct 0 ms 364 KB n = 2, 122 is a correct answer
23 Correct 1 ms 364 KB n = 10, 117 is a correct answer
24 Correct 0 ms 364 KB n = 10, 336 is a correct answer
25 Correct 0 ms 364 KB n = 10, 438 is a correct answer
26 Correct 0 ms 364 KB n = 10, 206 is a correct answer
27 Correct 0 ms 364 KB n = 10, 636 is a correct answer
28 Correct 0 ms 364 KB n = 4, 2399 is a correct answer
29 Correct 0 ms 364 KB n = 10, 10992 is a correct answer
30 Correct 1 ms 364 KB n = 10, 3112 is a correct answer
31 Incorrect 2 ms 364 KB n = 100, incorrect answer: jury 51000000001 vs contestant 10000000000
32 Halted 0 ms 0 KB -