#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i=a; i<int(b); i++)
long long findGap(int T, int N)
{
if (T==1) {
vector<long long> vals;
long long hi=1e18;
long long lo=0;
long long ans1,ans2;
rep (i,0,(N+1)/2) {
assert(lo<=hi);
MinMax(lo,hi,&ans1,&ans2);
vals.push_back(ans1);
vals.push_back(ans2);
lo=ans1+1;
hi=ans2-1;
}
sort(vals.begin(),vals.end());
long long maxdist=0;
rep (i,0,vals.size()) {
maxdist=max(maxdist,vals[i+1]-vals[i]);
//cout << maxdist << endl;
}
return maxdist;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
516 KB |
Output is correct |
7 |
Correct |
3 ms |
516 KB |
Output is correct |
8 |
Correct |
2 ms |
520 KB |
Output is correct |
9 |
Correct |
3 ms |
592 KB |
Output is correct |
10 |
Correct |
4 ms |
620 KB |
Output is correct |
11 |
Correct |
4 ms |
620 KB |
Output is correct |
12 |
Correct |
4 ms |
620 KB |
Output is correct |
13 |
Correct |
5 ms |
620 KB |
Output is correct |
14 |
Correct |
3 ms |
624 KB |
Output is correct |
15 |
Correct |
3 ms |
624 KB |
Output is correct |
16 |
Correct |
17 ms |
1132 KB |
Output is correct |
17 |
Correct |
19 ms |
1216 KB |
Output is correct |
18 |
Correct |
21 ms |
1216 KB |
Output is correct |
19 |
Correct |
18 ms |
1216 KB |
Output is correct |
20 |
Correct |
14 ms |
1216 KB |
Output is correct |
21 |
Correct |
69 ms |
2532 KB |
Output is correct |
22 |
Correct |
94 ms |
2532 KB |
Output is correct |
23 |
Correct |
85 ms |
2532 KB |
Output is correct |
24 |
Correct |
64 ms |
2532 KB |
Output is correct |
25 |
Correct |
55 ms |
2536 KB |
Output is correct |
26 |
Correct |
66 ms |
2536 KB |
Output is correct |
27 |
Correct |
74 ms |
2568 KB |
Output is correct |
28 |
Correct |
71 ms |
2568 KB |
Output is correct |
29 |
Correct |
68 ms |
2568 KB |
Output is correct |
30 |
Correct |
66 ms |
2568 KB |
Output is correct |
31 |
Correct |
3 ms |
2568 KB |
Output is correct |
32 |
Correct |
3 ms |
2568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
11 |
Incorrect |
4 ms |
2568 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
2568 KB |
Output isn't correct |
15 |
Incorrect |
4 ms |
2568 KB |
Output isn't correct |
16 |
Incorrect |
15 ms |
2568 KB |
Output isn't correct |
17 |
Incorrect |
14 ms |
2568 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
2568 KB |
Output isn't correct |
19 |
Incorrect |
16 ms |
2568 KB |
Output isn't correct |
20 |
Incorrect |
7 ms |
2568 KB |
Output isn't correct |
21 |
Incorrect |
51 ms |
2568 KB |
Output isn't correct |
22 |
Incorrect |
46 ms |
2568 KB |
Output isn't correct |
23 |
Incorrect |
40 ms |
2568 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
2568 KB |
Output isn't correct |
25 |
Incorrect |
38 ms |
2568 KB |
Output isn't correct |
26 |
Incorrect |
38 ms |
2568 KB |
Output isn't correct |
27 |
Incorrect |
44 ms |
2568 KB |
Output isn't correct |
28 |
Incorrect |
35 ms |
2568 KB |
Output isn't correct |
29 |
Incorrect |
39 ms |
2568 KB |
Output isn't correct |
30 |
Incorrect |
18 ms |
2568 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
2568 KB |
Output isn't correct |