# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
560852 |
2022-05-12T03:53:38 Z |
tamthegod |
Gap (APIO16_gap) |
C++14 |
|
55 ms |
1880 KB |
#include "gap.h"
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<cmath>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<cstdio>
#include<bitset>
#include<chrono>
#include<random>
#include<ext/rope>
/* ordered_set
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int maxN = 1e5 + 5;
const int mod = 1e9 + 7;
const ll oo = 1e18;
ll a[maxN];
ll findGap(int T, int n)
{
if(T == 1)
{
int low = 1, high = n;
a[n + 1] = (ll)2e18 + 1;
while(low <= high)
{
MinMax(a[low - 1] + 1, a[high + 1] - 1, &a[low], &a[high]);
low++;
high--;
}
ll res = 0;
for(int i=2; i<=n; i++)
res = max(res, abs(a[i] - a[i - 1]));
return res;
}
ll res = 0;
MinMax(0, oo, &a[1], &a[n]);
ll pre = a[1];
ll h = (a[n] - a[1] + n - 2) / (n - 1);
h--;
ll now = a[1] + 1;
while(true)
{
ll p, q;
MinMax(now, now + h, &p, &q);
res = max(res, p - pre);
pre = max(pre, q);
now += h + 1;
if(q == a[n]) break;
}
return res;
}
# |
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 |
0 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 |
664 KB |
Output is correct |
17 |
Correct |
10 ms |
708 KB |
Output is correct |
18 |
Correct |
11 ms |
592 KB |
Output is correct |
19 |
Correct |
9 ms |
700 KB |
Output is correct |
20 |
Correct |
7 ms |
592 KB |
Output is correct |
21 |
Correct |
38 ms |
1820 KB |
Output is correct |
22 |
Correct |
37 ms |
1772 KB |
Output is correct |
23 |
Correct |
42 ms |
1808 KB |
Output is correct |
24 |
Correct |
40 ms |
1820 KB |
Output is correct |
25 |
Correct |
32 ms |
1840 KB |
Output is correct |
26 |
Correct |
40 ms |
1880 KB |
Output is correct |
27 |
Correct |
37 ms |
1832 KB |
Output is correct |
28 |
Correct |
38 ms |
1756 KB |
Output is correct |
29 |
Correct |
36 ms |
1864 KB |
Output is correct |
30 |
Correct |
31 ms |
1840 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 |
1 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 |
0 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 |
12 ms |
500 KB |
Output is correct |
17 |
Correct |
13 ms |
464 KB |
Output is correct |
18 |
Correct |
13 ms |
520 KB |
Output is correct |
19 |
Correct |
13 ms |
432 KB |
Output is correct |
20 |
Correct |
7 ms |
464 KB |
Output is correct |
21 |
Correct |
50 ms |
1064 KB |
Output is correct |
22 |
Correct |
53 ms |
976 KB |
Output is correct |
23 |
Correct |
53 ms |
1092 KB |
Output is correct |
24 |
Correct |
52 ms |
968 KB |
Output is correct |
25 |
Correct |
45 ms |
1104 KB |
Output is correct |
26 |
Correct |
50 ms |
1084 KB |
Output is correct |
27 |
Correct |
55 ms |
1040 KB |
Output is correct |
28 |
Correct |
52 ms |
1064 KB |
Output is correct |
29 |
Correct |
54 ms |
972 KB |
Output is correct |
30 |
Correct |
27 ms |
1068 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |