# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
401964 |
2021-05-11T05:12:40 Z |
Maqsut_03 |
Gap (APIO16_gap) |
C++14 |
|
64 ms |
1864 KB |
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long findGap(int T, int N)
{
if(T == 1)
{
vector<long long> a;
a.reserve(N);
long long s = 0, e = 1e18;
while(int(a.size()) < N)
{
MinMax(s, e, &s, &e);
assert(s != -1);
a.push_back(s); a.push_back(e);
++s;
--e;
}
sort(a.begin(), a.end());
long long ans = 0;
for(int i = 0; i < int(a.size()) - 1; ++i)
ans = max(ans, a[i + 1] - a[i]);
return ans;
}
long long a1 = 0, aN = 0;
MinMax(0, (long long)1e18, &a1, &aN);
long long d = (aN - a1 + N - 2) / (N - 1), ans = d;
for(long long i=a1, p=a1; i<=aN; i+=d+1)
{
long long s = 0, e = 0;
MinMax(i, min(i + d, aN), &s, &e);
if(~s)
ans = max(ans, s - p), p = e;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
12 ms |
672 KB |
Output is correct |
17 |
Correct |
12 ms |
584 KB |
Output is correct |
18 |
Correct |
12 ms |
712 KB |
Output is correct |
19 |
Correct |
14 ms |
652 KB |
Output is correct |
20 |
Correct |
11 ms |
584 KB |
Output is correct |
21 |
Correct |
48 ms |
1752 KB |
Output is correct |
22 |
Correct |
51 ms |
1756 KB |
Output is correct |
23 |
Correct |
48 ms |
1764 KB |
Output is correct |
24 |
Correct |
47 ms |
1860 KB |
Output is correct |
25 |
Correct |
46 ms |
1864 KB |
Output is correct |
26 |
Correct |
52 ms |
1856 KB |
Output is correct |
27 |
Correct |
48 ms |
1824 KB |
Output is correct |
28 |
Correct |
48 ms |
1856 KB |
Output is correct |
29 |
Correct |
48 ms |
1856 KB |
Output is correct |
30 |
Correct |
42 ms |
1856 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
220 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
2 ms |
200 KB |
Output is correct |
12 |
Correct |
2 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
2 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
14 ms |
456 KB |
Output is correct |
17 |
Correct |
14 ms |
456 KB |
Output is correct |
18 |
Correct |
15 ms |
508 KB |
Output is correct |
19 |
Correct |
15 ms |
512 KB |
Output is correct |
20 |
Correct |
8 ms |
504 KB |
Output is correct |
21 |
Correct |
63 ms |
1052 KB |
Output is correct |
22 |
Correct |
61 ms |
1048 KB |
Output is correct |
23 |
Correct |
61 ms |
1056 KB |
Output is correct |
24 |
Correct |
59 ms |
1072 KB |
Output is correct |
25 |
Correct |
55 ms |
1176 KB |
Output is correct |
26 |
Correct |
64 ms |
1056 KB |
Output is correct |
27 |
Correct |
60 ms |
1052 KB |
Output is correct |
28 |
Correct |
60 ms |
1072 KB |
Output is correct |
29 |
Correct |
60 ms |
1052 KB |
Output is correct |
30 |
Correct |
32 ms |
1064 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
1 ms |
200 KB |
Output is correct |