# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
117912 |
2019-06-17T11:58:10 Z |
Mahdi_Jfri |
Gap (APIO16_gap) |
C++14 |
|
61 ms |
2040 KB |
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 1e5 + 20;
ll a[maxn];
long long findGap(int T, int n)
{
if(T == 1)
{
ll l = 0 , r = 1e18;
for(int i = 0; i < (n + 1) / 2; i++)
{
ll x , y;
MinMax(l , r , &x , &y);
a[i] = x;
a[n - i - 1] = y;
l = x + 1 , r = y - 1;
}
ll res = 0;
for(int i = 1; i < n; i++)
res = max(res , a[i] - a[i - 1]);
return res;
}
ll l ,r;
MinMax(1LL , 1000000000LL * 1000000000 , &l , &r);
ll res = (r - l + n - 2) / (n - 1);
ll a = l;
l++;
while(l < r)
{
ll s , t;
MinMax(l , l + res , &s , &t);
if(s == -1)
{
l += res + 1;
continue;
}
res = max(res , s - a);
a = t;
l = t + 1;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 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 |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
13 ms |
740 KB |
Output is correct |
17 |
Correct |
13 ms |
768 KB |
Output is correct |
18 |
Correct |
14 ms |
740 KB |
Output is correct |
19 |
Correct |
13 ms |
768 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
47 ms |
2040 KB |
Output is correct |
22 |
Correct |
47 ms |
1912 KB |
Output is correct |
23 |
Correct |
47 ms |
1912 KB |
Output is correct |
24 |
Correct |
47 ms |
1912 KB |
Output is correct |
25 |
Correct |
40 ms |
1912 KB |
Output is correct |
26 |
Correct |
48 ms |
1912 KB |
Output is correct |
27 |
Correct |
46 ms |
2040 KB |
Output is correct |
28 |
Correct |
46 ms |
1912 KB |
Output is correct |
29 |
Correct |
47 ms |
1912 KB |
Output is correct |
30 |
Correct |
35 ms |
1912 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 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 |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
10 ms |
512 KB |
Output is correct |
17 |
Correct |
10 ms |
512 KB |
Output is correct |
18 |
Correct |
9 ms |
512 KB |
Output is correct |
19 |
Correct |
10 ms |
512 KB |
Output is correct |
20 |
Correct |
7 ms |
512 KB |
Output is correct |
21 |
Correct |
54 ms |
1144 KB |
Output is correct |
22 |
Correct |
32 ms |
1144 KB |
Output is correct |
23 |
Correct |
33 ms |
1272 KB |
Output is correct |
24 |
Correct |
31 ms |
1144 KB |
Output is correct |
25 |
Correct |
61 ms |
1272 KB |
Output is correct |
26 |
Correct |
31 ms |
1152 KB |
Output is correct |
27 |
Correct |
31 ms |
1152 KB |
Output is correct |
28 |
Correct |
32 ms |
1144 KB |
Output is correct |
29 |
Correct |
37 ms |
1272 KB |
Output is correct |
30 |
Correct |
21 ms |
1152 KB |
Output is correct |
31 |
Correct |
2 ms |
384 KB |
Output is correct |
32 |
Correct |
2 ms |
384 KB |
Output is correct |