Submission #22015

# Submission time Handle Problem Language Result Execution time Memory
22015 2017-04-28T20:30:04 Z Hiasat Gap (APIO16_gap) C++14
30 / 100
63 ms 8308 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std; 
typedef long long ll;
 
vector<ll> v;

long long findGap(int T, int N) {
	ll mx = 0;
	if(T == 2){
		ll lo,hi;
		MinMax(1, 1e18, &lo, &hi);
		v.push_back(lo);
		v.push_back(hi);
		ll big = hi;
		ll sure = (hi-lo)/(N-1) + ((hi-lo)%(N-1) != 0);
		ll step = sure;
		ll cur = lo;
		mx = sure;
		while(cur < big){
			MinMax(cur, cur+step, &lo, &hi);
			if(lo == -1){
				step = sure + step;
				continue;
			}
			v.push_back(lo);
			v.push_back(hi);
			cur = hi+1;
		}
	}else{
		ll lo = 1, hi = 1e18;
		int rem =(N+1)/2;
		while(rem--){
			ll a , b;
			MinMax(lo,hi,&a,&b);
			if(a == -1)
				break;
			v.push_back(a);
			v.push_back(b);
			lo = a+1;
			hi = b-1;
		}
	}
	sort(v.begin(),v.end());
	for (int i = 0; i+1 < v.size(); ++i){
		mx = max(mx,v[i+1]-v[i]);
	}
	return mx;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:45:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i+1 < v.size(); ++i){
                      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5148 KB Output is correct
2 Correct 0 ms 5148 KB Output is correct
3 Correct 0 ms 5148 KB Output is correct
4 Correct 0 ms 5148 KB Output is correct
5 Correct 0 ms 5148 KB Output is correct
6 Correct 0 ms 5148 KB Output is correct
7 Correct 0 ms 5148 KB Output is correct
8 Correct 0 ms 5148 KB Output is correct
9 Correct 0 ms 5148 KB Output is correct
10 Correct 0 ms 5148 KB Output is correct
11 Correct 0 ms 5148 KB Output is correct
12 Correct 0 ms 5148 KB Output is correct
13 Correct 0 ms 5148 KB Output is correct
14 Correct 0 ms 5148 KB Output is correct
15 Correct 0 ms 5148 KB Output is correct
16 Correct 16 ms 5620 KB Output is correct
17 Correct 9 ms 5620 KB Output is correct
18 Correct 9 ms 5620 KB Output is correct
19 Correct 16 ms 5620 KB Output is correct
20 Correct 6 ms 5620 KB Output is correct
21 Correct 59 ms 6772 KB Output is correct
22 Correct 53 ms 6772 KB Output is correct
23 Correct 63 ms 6772 KB Output is correct
24 Correct 56 ms 6772 KB Output is correct
25 Correct 49 ms 6772 KB Output is correct
26 Correct 56 ms 6772 KB Output is correct
27 Correct 59 ms 6772 KB Output is correct
28 Correct 56 ms 6772 KB Output is correct
29 Correct 56 ms 6772 KB Output is correct
30 Correct 39 ms 6772 KB Output is correct
31 Correct 0 ms 5148 KB Output is correct
32 Correct 0 ms 5148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5148 KB Output is correct
2 Correct 0 ms 5148 KB Output is correct
3 Correct 0 ms 5148 KB Output is correct
4 Correct 0 ms 5148 KB Output is correct
5 Correct 0 ms 5148 KB Output is correct
6 Correct 0 ms 5148 KB Output is correct
7 Incorrect 0 ms 5148 KB Output isn't correct
8 Incorrect 0 ms 5148 KB Output isn't correct
9 Incorrect 0 ms 5148 KB Output isn't correct
10 Correct 0 ms 5148 KB Output is correct
11 Incorrect 0 ms 5148 KB Output isn't correct
12 Correct 0 ms 5148 KB Output is correct
13 Correct 0 ms 5148 KB Output is correct
14 Incorrect 0 ms 5148 KB Output isn't correct
15 Correct 0 ms 5292 KB Output is correct
16 Incorrect 9 ms 5292 KB Output isn't correct
17 Correct 13 ms 5292 KB Output is correct
18 Incorrect 6 ms 5292 KB Output isn't correct
19 Correct 6 ms 5292 KB Output is correct
20 Correct 3 ms 5148 KB Output is correct
21 Incorrect 33 ms 5620 KB Output isn't correct
22 Incorrect 36 ms 5620 KB Output isn't correct
23 Incorrect 36 ms 5620 KB Output isn't correct
24 Incorrect 26 ms 5620 KB Output isn't correct
25 Correct 63 ms 8308 KB Output is correct
26 Incorrect 26 ms 5620 KB Output isn't correct
27 Incorrect 29 ms 5620 KB Output isn't correct
28 Correct 23 ms 5620 KB Output is correct
29 Incorrect 33 ms 5620 KB Output isn't correct
30 Correct 23 ms 5292 KB Output is correct
31 Correct 0 ms 5148 KB Output is correct
32 Correct 0 ms 5148 KB Output is correct