# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
109436 |
2019-05-06T14:14:01 Z |
Plurm |
Gap (APIO16_gap) |
C++11 |
|
95 ms |
7044 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
set<long long> s;
void recur(const int& N, long long lo, long long hi){
if(lo > hi) return;
if(s.size() == N) return;
long long mn, mx;
MinMax(lo, hi, &mn, &mx);
if(mn == -1ll) return;
s.insert(mn);
s.insert(mx);
long long mid = (mn + mx)/2ll;
recur(N, mn+1, mid);
recur(N, mid, mx-1);
}
long long findGap(int T, int N)
{
long long mn, mx;
if(T == 1){
long long lo = 0ll;
long long hi = 1e18;
do{
MinMax(lo, hi, &mn, &mx);
if(mn == -1) break;
s.insert(mn);
s.insert(mx);
lo = mn + 1;
hi = mx - 1;
}while(lo <= hi && s.size() < N);
}else{
recur(N, 0ll, (long long)1e18);
}
vector<long long> v;
for(long long x : s) v.push_back(x);
mx = 0ll;
for(int i = 1; i < N; i++){
mx = max(mx, v[i] - v[i-1]);
}
return mx;
return 0;
}
Compilation message
gap.cpp: In function 'void recur(const int&, long long int, long long int)':
gap.cpp:8:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(s.size() == N) return;
~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
}while(lo <= hi && s.size() < N);
~~~~~~~~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
3 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
19 ms |
2176 KB |
Output is correct |
17 |
Correct |
22 ms |
2040 KB |
Output is correct |
18 |
Correct |
22 ms |
2176 KB |
Output is correct |
19 |
Correct |
24 ms |
2048 KB |
Output is correct |
20 |
Correct |
18 ms |
2176 KB |
Output is correct |
21 |
Correct |
82 ms |
7028 KB |
Output is correct |
22 |
Correct |
90 ms |
6968 KB |
Output is correct |
23 |
Correct |
94 ms |
6904 KB |
Output is correct |
24 |
Correct |
79 ms |
7044 KB |
Output is correct |
25 |
Correct |
85 ms |
7032 KB |
Output is correct |
26 |
Correct |
94 ms |
7028 KB |
Output is correct |
27 |
Correct |
89 ms |
6924 KB |
Output is correct |
28 |
Correct |
93 ms |
7016 KB |
Output is correct |
29 |
Correct |
90 ms |
6936 KB |
Output is correct |
30 |
Correct |
73 ms |
7028 KB |
Output is correct |
31 |
Correct |
3 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Partially correct |
2 ms |
384 KB |
Partially correct |
3 |
Partially correct |
2 ms |
384 KB |
Partially correct |
4 |
Partially correct |
2 ms |
384 KB |
Partially correct |
5 |
Partially correct |
2 ms |
384 KB |
Partially correct |
6 |
Partially correct |
2 ms |
356 KB |
Partially correct |
7 |
Partially correct |
2 ms |
384 KB |
Partially correct |
8 |
Partially correct |
2 ms |
384 KB |
Partially correct |
9 |
Partially correct |
2 ms |
384 KB |
Partially correct |
10 |
Partially correct |
2 ms |
384 KB |
Partially correct |
11 |
Partially correct |
4 ms |
512 KB |
Partially correct |
12 |
Partially correct |
4 ms |
512 KB |
Partially correct |
13 |
Partially correct |
4 ms |
384 KB |
Partially correct |
14 |
Partially correct |
4 ms |
384 KB |
Partially correct |
15 |
Partially correct |
4 ms |
384 KB |
Partially correct |
16 |
Partially correct |
31 ms |
2040 KB |
Partially correct |
17 |
Partially correct |
22 ms |
2048 KB |
Partially correct |
18 |
Partially correct |
25 ms |
2168 KB |
Partially correct |
19 |
Partially correct |
26 ms |
2168 KB |
Partially correct |
20 |
Partially correct |
21 ms |
2040 KB |
Partially correct |
21 |
Partially correct |
85 ms |
7028 KB |
Partially correct |
22 |
Partially correct |
91 ms |
7028 KB |
Partially correct |
23 |
Partially correct |
88 ms |
7032 KB |
Partially correct |
24 |
Partially correct |
90 ms |
7020 KB |
Partially correct |
25 |
Partially correct |
94 ms |
7028 KB |
Partially correct |
26 |
Partially correct |
94 ms |
6992 KB |
Partially correct |
27 |
Partially correct |
92 ms |
6996 KB |
Partially correct |
28 |
Partially correct |
86 ms |
7028 KB |
Partially correct |
29 |
Partially correct |
95 ms |
7000 KB |
Partially correct |
30 |
Partially correct |
93 ms |
7028 KB |
Partially correct |
31 |
Partially correct |
2 ms |
384 KB |
Partially correct |
32 |
Partially correct |
3 ms |
384 KB |
Partially correct |