# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
732241 |
2023-04-28T19:10:40 Z |
1ne |
Gap (APIO16_gap) |
C++14 |
|
51 ms |
1872 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
long long ans = 1;
if (T == 1){
long long s = -1,t = 1e18 + 1;
long long x = 0,y = 0;
vector<long long>pos(N);
int l = 0,r = N - 1;
while(l <= r && s<=t){
MinMax(s,t,&x,&y);
if (x == -1 && y == -1){
break;
}
pos[l] = x;
pos[r] = y;
--r;
++l;
s = x + 1;
t = y - 1;
}
sort(pos.begin(),pos.end());
for (int i = 1;i<N;++i){
ans = max(ans,pos[i] - pos[i - 1]);
}
}
else{
long long x,y,xx,yy;
long long s = 0,t = 1e18,lst = 0;
MinMax(s,t,&xx,&yy);
lst = xx;
long long block = (yy - xx - 2 + N) / (N - 1);
for (long long i = xx + 1;i<=yy - 1;i+=block){
MinMax(i,i + block - 1,&x,&y);
if (x == -1)continue;
ans = max(ans,x - lst);
lst = y;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
292 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
9 ms |
680 KB |
Output is correct |
17 |
Correct |
9 ms |
676 KB |
Output is correct |
18 |
Correct |
10 ms |
608 KB |
Output is correct |
19 |
Correct |
10 ms |
720 KB |
Output is correct |
20 |
Correct |
8 ms |
592 KB |
Output is correct |
21 |
Correct |
37 ms |
1856 KB |
Output is correct |
22 |
Correct |
36 ms |
1836 KB |
Output is correct |
23 |
Correct |
38 ms |
1824 KB |
Output is correct |
24 |
Correct |
38 ms |
1824 KB |
Output is correct |
25 |
Correct |
32 ms |
1844 KB |
Output is correct |
26 |
Correct |
38 ms |
1812 KB |
Output is correct |
27 |
Correct |
38 ms |
1772 KB |
Output is correct |
28 |
Correct |
39 ms |
1824 KB |
Output is correct |
29 |
Correct |
43 ms |
1828 KB |
Output is correct |
30 |
Correct |
28 ms |
1872 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
2 ms |
208 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
12 ms |
512 KB |
Output is correct |
17 |
Correct |
12 ms |
416 KB |
Output is correct |
18 |
Correct |
12 ms |
512 KB |
Output is correct |
19 |
Correct |
12 ms |
464 KB |
Output is correct |
20 |
Correct |
6 ms |
504 KB |
Output is correct |
21 |
Correct |
49 ms |
1084 KB |
Output is correct |
22 |
Correct |
50 ms |
1012 KB |
Output is correct |
23 |
Correct |
49 ms |
1084 KB |
Output is correct |
24 |
Correct |
51 ms |
1076 KB |
Output is correct |
25 |
Correct |
44 ms |
1056 KB |
Output is correct |
26 |
Correct |
50 ms |
988 KB |
Output is correct |
27 |
Correct |
48 ms |
1088 KB |
Output is correct |
28 |
Correct |
49 ms |
1080 KB |
Output is correct |
29 |
Correct |
50 ms |
968 KB |
Output is correct |
30 |
Correct |
30 ms |
968 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |