# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
560779 |
2022-05-12T02:29:26 Z |
Tien_Noob |
Gap (APIO16_gap) |
C++17 |
|
55 ms |
1864 KB |
//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#include "gap.h"
#define TASK "TESTCODE"
#define Log2(x) 31 - __builtin_clz(x)
using namespace std;
const int N = 1e5;
long long a[N + 2];
long long findGap(int t, int n)
{
if (t == 1)
{
a[0] = -1;
a[n + 1] = 2e18 + 1;
for (int i = 1, j = n; i <= j; ++ i, -- j)
{
MinMax(a[i - 1] + 1, a[j + 1] - 1, &a[i], &a[j]);
}
long long res = 0;
for (int i = 2; i <= n; ++ i)
{
res = max(res, a[i] - a[i - 1]);
}
return res;
}
long long res = 0;
long long mn, mx;
MinMax(0, 1e18, &mn, &mx);
long long maxPre = -1;
long long tmn, tmx;
tmn = mn;
tmx = mx;
if (n == 2)
{
return mx - mn;
}
--n;
for (long long l = tmn; l < tmx; l += (tmx - tmn)/n + 1)
{
MinMax(l, l + (tmx - tmn)/n, &mn, &mx);
if (mn == -1)
{
continue;
}
if (maxPre != -1)
{
res = max(res, mn - maxPre);
}
maxPre = mx;
}
return res;
}
/*void read()
{
}
void solve()
{
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
if (fopen(TASK".INP", "r"))
{
freopen(TASK".INP", "r", stdin);
//freopen(TASK".OUT", "w", stdout);
}
int t = 1;
bool typetest = false;
if (typetest)
{
cin >> t;
}
for (int __ = 1; __ <= t; ++ __)
{
//cout << "Case " << __ << ": ";
read();
solve();
}
}*/
# |
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 |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 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 |
10 ms |
692 KB |
Output is correct |
17 |
Correct |
11 ms |
688 KB |
Output is correct |
18 |
Correct |
13 ms |
624 KB |
Output is correct |
19 |
Correct |
9 ms |
720 KB |
Output is correct |
20 |
Correct |
8 ms |
604 KB |
Output is correct |
21 |
Correct |
36 ms |
1736 KB |
Output is correct |
22 |
Correct |
37 ms |
1784 KB |
Output is correct |
23 |
Correct |
36 ms |
1776 KB |
Output is correct |
24 |
Correct |
36 ms |
1864 KB |
Output is correct |
25 |
Correct |
35 ms |
1752 KB |
Output is correct |
26 |
Correct |
42 ms |
1808 KB |
Output is correct |
27 |
Correct |
44 ms |
1864 KB |
Output is correct |
28 |
Correct |
38 ms |
1828 KB |
Output is correct |
29 |
Correct |
38 ms |
1840 KB |
Output is correct |
30 |
Correct |
31 ms |
1864 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 |
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 |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 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 |
2 ms |
336 KB |
Output is correct |
16 |
Correct |
12 ms |
464 KB |
Output is correct |
17 |
Correct |
12 ms |
516 KB |
Output is correct |
18 |
Correct |
13 ms |
516 KB |
Output is correct |
19 |
Correct |
12 ms |
500 KB |
Output is correct |
20 |
Correct |
6 ms |
464 KB |
Output is correct |
21 |
Correct |
53 ms |
1064 KB |
Output is correct |
22 |
Correct |
52 ms |
1080 KB |
Output is correct |
23 |
Correct |
52 ms |
984 KB |
Output is correct |
24 |
Correct |
49 ms |
1048 KB |
Output is correct |
25 |
Correct |
53 ms |
1104 KB |
Output is correct |
26 |
Correct |
53 ms |
1084 KB |
Output is correct |
27 |
Correct |
49 ms |
1084 KB |
Output is correct |
28 |
Correct |
55 ms |
1204 KB |
Output is correct |
29 |
Correct |
51 ms |
1052 KB |
Output is correct |
30 |
Correct |
27 ms |
1080 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |