# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
101702 |
2019-03-19T14:12:04 Z |
ae04071 |
Gap (APIO16_gap) |
C++11 |
|
2000 ms |
1272 KB |
#include "gap.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using namespace std;
using lli=long long;
using pll=pair<lli,lli>;
const lli INF=1000000000000000000ll;
lli sub1(int n) {
lli mx=0, lv=-1, rv=INF+1;
for(int i=0;i<(n+1)/2;i++) {
lli s=lv, t=rv, l, r;
MinMax(s+1, t-1, &l, &r);
if(i!=0) {
mx = max(mx, l-lv);
mx = max(mx, rv-r);
}
lv = l; rv = r;
}
if(!(n&1)) mx = max(mx, rv-lv);
return mx;
}
lli sub2(int n) {
lli s=0,f=INF,l,r;
MinMax(s, f, &l, &r);
lli seg = (r-l)/n,mx=0;
s=l+1;
while(s<r) {
f = s+seg;
if(f >= r) f=r-1;
lli lv,rv;
MinMax(s, f, &lv, &rv);
if(lv!=-1) {
mx = max(mx, lv-l);
l = rv;
}
}
mx = max(mx, r-l);
return mx;
}
long long findGap(int T, int N)
{
if(T==1) return sub1(N);
else return sub2(N);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
17 ms |
512 KB |
Output is correct |
17 |
Correct |
17 ms |
516 KB |
Output is correct |
18 |
Correct |
14 ms |
512 KB |
Output is correct |
19 |
Correct |
14 ms |
512 KB |
Output is correct |
20 |
Correct |
11 ms |
512 KB |
Output is correct |
21 |
Correct |
62 ms |
1188 KB |
Output is correct |
22 |
Correct |
65 ms |
1036 KB |
Output is correct |
23 |
Correct |
50 ms |
1144 KB |
Output is correct |
24 |
Correct |
51 ms |
1016 KB |
Output is correct |
25 |
Correct |
58 ms |
1272 KB |
Output is correct |
26 |
Correct |
66 ms |
1116 KB |
Output is correct |
27 |
Correct |
51 ms |
1144 KB |
Output is correct |
28 |
Correct |
51 ms |
1152 KB |
Output is correct |
29 |
Correct |
49 ms |
1272 KB |
Output is correct |
30 |
Correct |
36 ms |
1156 KB |
Output is correct |
31 |
Correct |
3 ms |
384 KB |
Output is correct |
32 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2061 ms |
384 KB |
Time limit exceeded |
2 |
Execution timed out |
2016 ms |
384 KB |
Time limit exceeded |
3 |
Execution timed out |
2009 ms |
384 KB |
Time limit exceeded |
4 |
Execution timed out |
2032 ms |
384 KB |
Time limit exceeded |
5 |
Execution timed out |
2040 ms |
384 KB |
Time limit exceeded |
6 |
Execution timed out |
2013 ms |
384 KB |
Time limit exceeded |
7 |
Execution timed out |
2025 ms |
428 KB |
Time limit exceeded |
8 |
Execution timed out |
2045 ms |
432 KB |
Time limit exceeded |
9 |
Execution timed out |
2025 ms |
384 KB |
Time limit exceeded |
10 |
Execution timed out |
2045 ms |
384 KB |
Time limit exceeded |
11 |
Execution timed out |
2049 ms |
384 KB |
Time limit exceeded |
12 |
Execution timed out |
2045 ms |
384 KB |
Time limit exceeded |
13 |
Execution timed out |
2039 ms |
384 KB |
Time limit exceeded |
14 |
Execution timed out |
2040 ms |
384 KB |
Time limit exceeded |
15 |
Execution timed out |
2015 ms |
356 KB |
Time limit exceeded |
16 |
Execution timed out |
2017 ms |
532 KB |
Time limit exceeded |
17 |
Execution timed out |
2087 ms |
512 KB |
Time limit exceeded |
18 |
Execution timed out |
2035 ms |
512 KB |
Time limit exceeded |
19 |
Execution timed out |
2039 ms |
512 KB |
Time limit exceeded |
20 |
Execution timed out |
2068 ms |
512 KB |
Time limit exceeded |
21 |
Execution timed out |
2063 ms |
1144 KB |
Time limit exceeded |
22 |
Execution timed out |
2035 ms |
1144 KB |
Time limit exceeded |
23 |
Execution timed out |
2017 ms |
1144 KB |
Time limit exceeded |
24 |
Execution timed out |
2047 ms |
1144 KB |
Time limit exceeded |
25 |
Execution timed out |
2061 ms |
1152 KB |
Time limit exceeded |
26 |
Execution timed out |
2021 ms |
1144 KB |
Time limit exceeded |
27 |
Execution timed out |
2035 ms |
1144 KB |
Time limit exceeded |
28 |
Execution timed out |
2027 ms |
1144 KB |
Time limit exceeded |
29 |
Execution timed out |
2019 ms |
1152 KB |
Time limit exceeded |
30 |
Execution timed out |
2057 ms |
1152 KB |
Time limit exceeded |
31 |
Execution timed out |
2061 ms |
256 KB |
Time limit exceeded |
32 |
Execution timed out |
2048 ms |
384 KB |
Time limit exceeded |