# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
47778 |
2018-05-07T08:20:10 Z |
ikura355 |
Gap (APIO16_gap) |
C++14 |
|
78 ms |
2188 KB |
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
const ll inf = 2e18;
ll a[maxn];
ll findGap(int T, int N) {
if(T==1) {
ll L = -inf, R = inf;
for(int i=1,j=N;i<=j;i++,j--) {
MinMax(L+1,R-1,&L,&R);
a[i] = L; a[j] = R;
}
ll ans = 0;
for(int i=1;i<N;i++) ans = max(ans, a[i+1]-a[i]);
return ans;
}
else {
ll L, R;
MinMax(0,inf,&L,&R);
ll sz = (R-L-1)/(N-1);
ll ans = 0, last = L;
for(ll x=L+1;x<=R-1;x+=sz) {
ll t1, t2;
MinMax(x,min(R-1,x+sz-1),&t1,&t2);
if(t1==-1) continue;
ans = max(ans, t1-last);
last = t2;
}
ans = max(ans, R-last);
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
2 ms |
536 KB |
Output is correct |
7 |
Correct |
2 ms |
672 KB |
Output is correct |
8 |
Correct |
2 ms |
672 KB |
Output is correct |
9 |
Correct |
2 ms |
672 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Correct |
3 ms |
672 KB |
Output is correct |
12 |
Correct |
2 ms |
672 KB |
Output is correct |
13 |
Correct |
4 ms |
672 KB |
Output is correct |
14 |
Correct |
3 ms |
672 KB |
Output is correct |
15 |
Correct |
3 ms |
672 KB |
Output is correct |
16 |
Correct |
23 ms |
1020 KB |
Output is correct |
17 |
Correct |
22 ms |
1020 KB |
Output is correct |
18 |
Correct |
15 ms |
1020 KB |
Output is correct |
19 |
Correct |
19 ms |
1020 KB |
Output is correct |
20 |
Correct |
11 ms |
1020 KB |
Output is correct |
21 |
Correct |
59 ms |
2148 KB |
Output is correct |
22 |
Correct |
59 ms |
2172 KB |
Output is correct |
23 |
Correct |
58 ms |
2176 KB |
Output is correct |
24 |
Correct |
59 ms |
2188 KB |
Output is correct |
25 |
Correct |
50 ms |
2188 KB |
Output is correct |
26 |
Correct |
58 ms |
2188 KB |
Output is correct |
27 |
Correct |
60 ms |
2188 KB |
Output is correct |
28 |
Correct |
59 ms |
2188 KB |
Output is correct |
29 |
Correct |
60 ms |
2188 KB |
Output is correct |
30 |
Correct |
43 ms |
2188 KB |
Output is correct |
31 |
Correct |
2 ms |
2188 KB |
Output is correct |
32 |
Correct |
2 ms |
2188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2188 KB |
Output is correct |
2 |
Correct |
2 ms |
2188 KB |
Output is correct |
3 |
Correct |
2 ms |
2188 KB |
Output is correct |
4 |
Correct |
2 ms |
2188 KB |
Output is correct |
5 |
Correct |
2 ms |
2188 KB |
Output is correct |
6 |
Correct |
2 ms |
2188 KB |
Output is correct |
7 |
Correct |
2 ms |
2188 KB |
Output is correct |
8 |
Correct |
2 ms |
2188 KB |
Output is correct |
9 |
Correct |
2 ms |
2188 KB |
Output is correct |
10 |
Correct |
2 ms |
2188 KB |
Output is correct |
11 |
Correct |
3 ms |
2188 KB |
Output is correct |
12 |
Correct |
3 ms |
2188 KB |
Output is correct |
13 |
Correct |
3 ms |
2188 KB |
Output is correct |
14 |
Correct |
3 ms |
2188 KB |
Output is correct |
15 |
Correct |
3 ms |
2188 KB |
Output is correct |
16 |
Correct |
20 ms |
2188 KB |
Output is correct |
17 |
Correct |
20 ms |
2188 KB |
Output is correct |
18 |
Correct |
21 ms |
2188 KB |
Output is correct |
19 |
Correct |
20 ms |
2188 KB |
Output is correct |
20 |
Partially correct |
10 ms |
2188 KB |
Partially correct |
21 |
Correct |
77 ms |
2188 KB |
Output is correct |
22 |
Correct |
75 ms |
2188 KB |
Output is correct |
23 |
Correct |
74 ms |
2188 KB |
Output is correct |
24 |
Correct |
75 ms |
2188 KB |
Output is correct |
25 |
Correct |
70 ms |
2188 KB |
Output is correct |
26 |
Correct |
78 ms |
2188 KB |
Output is correct |
27 |
Correct |
77 ms |
2188 KB |
Output is correct |
28 |
Correct |
75 ms |
2188 KB |
Output is correct |
29 |
Correct |
75 ms |
2188 KB |
Output is correct |
30 |
Partially correct |
40 ms |
2188 KB |
Partially correct |
31 |
Correct |
2 ms |
2188 KB |
Output is correct |
32 |
Correct |
2 ms |
2188 KB |
Output is correct |