# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
536185 |
2022-03-12T14:45:42 Z |
mario05092929 |
Gap (APIO16_gap) |
C++17 |
|
64 ms |
1872 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100005];
int lp,rp;
long long findGap(int T, int N) {
ll n = N;
ll l = 0, r = 1e18,mn,mx;
if(T == 1) {
MinMax(l,r,&mn,&mx);
lp = 1, rp = n;
while(1) {
a[lp++] = mn;
a[rp--] = mx;
l = mn+1, r = mx-1;
if(lp > rp) break;
MinMax(l,r,&mn,&mx);
}
ll mxx = 0;
for(int i = 1;i < n;i++) {
mxx = max(mxx,a[i+1]-a[i]);
}
return mxx;
}
else {
MinMax(l,r,&mn,&mx);
ll diff = 0;
ll len = (mx-mn+1)/n+1;
ll st = mn+1;
ll tmn,tmx;
for(int i = 1;i <= n;i++) {
MinMax(st,st+len-1,&tmn,&tmx);
st += len;
if(tmn == -1) continue;
diff = max(diff,tmn-mn);
mn = tmx;
}
return diff;
}
}
# |
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 |
336 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 |
1 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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
11 ms |
700 KB |
Output is correct |
17 |
Correct |
11 ms |
612 KB |
Output is correct |
18 |
Correct |
11 ms |
720 KB |
Output is correct |
19 |
Correct |
12 ms |
688 KB |
Output is correct |
20 |
Correct |
8 ms |
592 KB |
Output is correct |
21 |
Correct |
46 ms |
1832 KB |
Output is correct |
22 |
Correct |
41 ms |
1840 KB |
Output is correct |
23 |
Correct |
42 ms |
1832 KB |
Output is correct |
24 |
Correct |
43 ms |
1808 KB |
Output is correct |
25 |
Correct |
38 ms |
1836 KB |
Output is correct |
26 |
Correct |
48 ms |
1848 KB |
Output is correct |
27 |
Correct |
43 ms |
1864 KB |
Output is correct |
28 |
Correct |
48 ms |
1756 KB |
Output is correct |
29 |
Correct |
41 ms |
1872 KB |
Output is correct |
30 |
Correct |
34 ms |
1816 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 |
1 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 |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
340 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 |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
15 ms |
464 KB |
Output is correct |
17 |
Correct |
13 ms |
492 KB |
Output is correct |
18 |
Correct |
14 ms |
464 KB |
Output is correct |
19 |
Correct |
13 ms |
432 KB |
Output is correct |
20 |
Correct |
6 ms |
464 KB |
Output is correct |
21 |
Correct |
54 ms |
1064 KB |
Output is correct |
22 |
Correct |
55 ms |
968 KB |
Output is correct |
23 |
Correct |
64 ms |
1088 KB |
Output is correct |
24 |
Correct |
59 ms |
1064 KB |
Output is correct |
25 |
Correct |
49 ms |
1088 KB |
Output is correct |
26 |
Correct |
58 ms |
1072 KB |
Output is correct |
27 |
Correct |
52 ms |
1088 KB |
Output is correct |
28 |
Correct |
51 ms |
1092 KB |
Output is correct |
29 |
Correct |
53 ms |
1064 KB |
Output is correct |
30 |
Correct |
32 ms |
976 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |