# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1030063 |
2024-07-21T18:30:13 Z |
KasymK |
Gap (APIO16_gap) |
C++17 |
|
43 ms |
3748 KB |
#include "bits/stdc++.h"
#include "gap.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int MOD = 1e9+7;
const int N = 1e5+5;
ll a[N];
ll findGap(int t, int n){
if(t == 1){
ll l = 0, r = 1e18, id = 0, mn, mx, ans = 0;
for(int i = 0; i < (n+1)/2; ++i){
MinMax(l, r, &mn, &mx);
a[id++] = mn, a[id++] = mx, l = mn+1, r = mx-1;
}
sort(a, a+n);
for(int i = 0; i < n-1; ++i)
umax(ans, a[i+1]-a[i]);
return ans;
}
ll a_, b_, mn, mx, id = 0, l = 0, r = 1e18;
MinMax(l, r, &mn, &mx);
ll d = (mx-mn-1)/(n-1);
a[id++] = mn;
for(ll i = mn+1; i < mx; i+=d+1){
MinMax(i, min(i+d, mx-1), &a_, &b_);
if(a_ != -1)
a[id++] = a_, a[id++] = b_;
}
a[id++] = mx;
id--;
// for(int i = 0;; ++i)
// if(a[i]){
// id = i;
// break;
// }
ll ans = 0;
for(int i = 0; i < id-1; ++i)
umax(ans, a[i+1]-a[i]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
7 ms |
692 KB |
Output is correct |
17 |
Correct |
7 ms |
600 KB |
Output is correct |
18 |
Correct |
7 ms |
600 KB |
Output is correct |
19 |
Correct |
7 ms |
804 KB |
Output is correct |
20 |
Correct |
6 ms |
600 KB |
Output is correct |
21 |
Correct |
39 ms |
1812 KB |
Output is correct |
22 |
Correct |
30 ms |
1872 KB |
Output is correct |
23 |
Correct |
28 ms |
1880 KB |
Output is correct |
24 |
Correct |
28 ms |
1880 KB |
Output is correct |
25 |
Correct |
28 ms |
1880 KB |
Output is correct |
26 |
Correct |
28 ms |
1880 KB |
Output is correct |
27 |
Correct |
28 ms |
1876 KB |
Output is correct |
28 |
Correct |
41 ms |
1784 KB |
Output is correct |
29 |
Correct |
28 ms |
1880 KB |
Output is correct |
30 |
Correct |
25 ms |
1880 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
8 ms |
856 KB |
Output is correct |
17 |
Correct |
11 ms |
856 KB |
Output is correct |
18 |
Correct |
8 ms |
856 KB |
Output is correct |
19 |
Correct |
12 ms |
968 KB |
Output is correct |
20 |
Correct |
6 ms |
600 KB |
Output is correct |
21 |
Runtime error |
38 ms |
3664 KB |
Execution killed with signal 11 |
22 |
Runtime error |
31 ms |
3672 KB |
Execution killed with signal 11 |
23 |
Runtime error |
32 ms |
3664 KB |
Execution killed with signal 11 |
24 |
Runtime error |
35 ms |
3516 KB |
Execution killed with signal 11 |
25 |
Runtime error |
22 ms |
3748 KB |
Execution killed with signal 11 |
26 |
Runtime error |
39 ms |
3612 KB |
Execution killed with signal 11 |
27 |
Runtime error |
31 ms |
3664 KB |
Execution killed with signal 11 |
28 |
Runtime error |
43 ms |
3552 KB |
Execution killed with signal 11 |
29 |
Runtime error |
34 ms |
3664 KB |
Execution killed with signal 11 |
30 |
Correct |
21 ms |
1368 KB |
Output is correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |