#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);
ll cur = lo;
mx = sure;
while(cur < big){
MinMax(cur, cur+sure, &lo, &hi);
if(lo == -1){
cur = cur + sure;
continue;
}
v.push_back(lo);
v.push_back(hi);
cur = hi+1;
}
}else{
ll lo = 1, hi = 1e18;
vector<ll> v;
while(lo < hi){
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:47:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i+1 < v.size(); ++i){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
5148 KB |
Output isn't 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 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
16 |
Incorrect |
13 ms |
5620 KB |
Output isn't correct |
17 |
Incorrect |
16 ms |
5620 KB |
Output isn't correct |
18 |
Incorrect |
13 ms |
5620 KB |
Output isn't correct |
19 |
Incorrect |
13 ms |
5620 KB |
Output isn't correct |
20 |
Incorrect |
6 ms |
5620 KB |
Output isn't correct |
21 |
Incorrect |
43 ms |
6772 KB |
Output isn't correct |
22 |
Incorrect |
43 ms |
6772 KB |
Output isn't correct |
23 |
Incorrect |
56 ms |
6772 KB |
Output isn't correct |
24 |
Incorrect |
46 ms |
6772 KB |
Output isn't correct |
25 |
Incorrect |
39 ms |
6772 KB |
Output isn't correct |
26 |
Incorrect |
39 ms |
6772 KB |
Output isn't correct |
27 |
Incorrect |
69 ms |
6772 KB |
Output isn't correct |
28 |
Incorrect |
46 ms |
6772 KB |
Output isn't correct |
29 |
Incorrect |
59 ms |
6772 KB |
Output isn't correct |
30 |
Incorrect |
36 ms |
6772 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
5148 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5148 KB |
Output is correct |
2 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
3 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
4 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
5 |
Correct |
0 ms |
5148 KB |
Output is correct |
6 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
7 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
8 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
9 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
10 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
11 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
12 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
13 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
14 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
15 |
Correct |
0 ms |
5292 KB |
Output is correct |
16 |
Partially correct |
16 ms |
6004 KB |
Partially correct |
17 |
Partially correct |
19 ms |
6004 KB |
Partially correct |
18 |
Partially correct |
19 ms |
6004 KB |
Partially correct |
19 |
Partially correct |
23 ms |
6004 KB |
Partially correct |
20 |
Partially correct |
3 ms |
5148 KB |
Partially correct |
21 |
Partially correct |
79 ms |
8308 KB |
Partially correct |
22 |
Partially correct |
103 ms |
8308 KB |
Partially correct |
23 |
Partially correct |
83 ms |
8308 KB |
Partially correct |
24 |
Partially correct |
83 ms |
8308 KB |
Partially correct |
25 |
Correct |
73 ms |
8308 KB |
Output is correct |
26 |
Partially correct |
79 ms |
8308 KB |
Partially correct |
27 |
Partially correct |
83 ms |
8308 KB |
Partially correct |
28 |
Partially correct |
79 ms |
8308 KB |
Partially correct |
29 |
Partially correct |
79 ms |
8308 KB |
Partially correct |
30 |
Partially correct |
49 ms |
5620 KB |
Partially correct |
31 |
Partially correct |
0 ms |
5148 KB |
Partially correct |
32 |
Partially correct |
0 ms |
5148 KB |
Partially correct |