## Submission #255787

# Submission time Handle Problem Language Result Execution time Memory
255787 2020-08-01T20:35:46 Z Osama_Alkhodairy Gap (APIO16_gap) C++17
70 / 100
73 ms 2864 KB
```#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#define ll long long

ll findGap(int T, int N){
ll mn, mx;
if(T == 1){
MinMax(0, 1e18, &mn, &mx);
ll ans = 0;
while(mn + 1 < mx){
ll new_mn, new_mx;
MinMax(mn + 1, mx - 1, &new_mn, &new_mx);
if(new_mn == -1){
ans = max(ans, mx - mn);
}
ans = max(ans, new_mn - mn);
ans = max(ans, mx - new_mx);
mn = new_mn;
mx = new_mx;
}
if(mn != mx) ans = max(ans, mx - mn);
return ans;
}
MinMax(0, 1e18, &mn, &mx);
ll l = mn, r = mx;
ll g = (r - l - (N - 2)) / (N - 1);
ll cur_l = l;
vector <ll> mnq, mxq;
for(int i = 0 ; cur_l < r ; i++){
ll sz = g + (i < (r - l - (N - 2)) % (N - 1));
ll cur_r = cur_l + sz;
MinMax(cur_l, cur_r, &mn, &mx);
if(mn != -1){
mnq.push_back(mn);
mxq.push_back(mx);
}
cur_l += sz + 1;
}
ll ans = (r - l + N - 2) / (N - 1);
for(int i = 1 ; i < (int)mnq.size() ; i++){
ans = max(ans, mnq[i] - mxq[i - 1]);
}
return ans;
}
```

#### Subtask #1 0 / 30.0

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 368 KB Output isn't correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Incorrect 0 ms 384 KB Output isn't correct
7 Incorrect 0 ms 384 KB Output isn't correct
8 Incorrect 0 ms 384 KB Output isn't correct
9 Incorrect 0 ms 384 KB Output isn't correct
10 Correct 0 ms 384 KB Output is correct
11 Incorrect 1 ms 384 KB Output isn't correct
12 Incorrect 1 ms 384 KB Output isn't correct
13 Incorrect 1 ms 384 KB Output isn't correct
14 Incorrect 1 ms 384 KB Output isn't correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Incorrect 12 ms 512 KB Output isn't correct
17 Incorrect 12 ms 512 KB Output isn't correct
18 Incorrect 12 ms 512 KB Output isn't correct
19 Incorrect 14 ms 512 KB Output isn't correct
20 Correct 8 ms 512 KB Output is correct
21 Incorrect 48 ms 1164 KB Output isn't correct
22 Incorrect 49 ms 1148 KB Output isn't correct
23 Incorrect 49 ms 1144 KB Output isn't correct
24 Incorrect 48 ms 1120 KB Output isn't correct
25 Incorrect 42 ms 1152 KB Output isn't correct
26 Incorrect 50 ms 1152 KB Output isn't correct
27 Incorrect 52 ms 1156 KB Output isn't correct
28 Incorrect 50 ms 1144 KB Output isn't correct
29 Incorrect 52 ms 1052 KB Output isn't correct
30 Correct 34 ms 1172 KB Output is correct
31 Correct 0 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct

#### Subtask #2 70.0 / 70.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 18 ms 896 KB Output is correct
17 Correct 16 ms 896 KB Output is correct
18 Correct 16 ms 896 KB Output is correct
19 Correct 16 ms 896 KB Output is correct
20 Correct 9 ms 512 KB Output is correct
21 Correct 73 ms 2268 KB Output is correct
22 Correct 65 ms 2208 KB Output is correct
23 Correct 66 ms 2204 KB Output is correct
24 Correct 68 ms 2236 KB Output is correct
25 Correct 63 ms 2864 KB Output is correct
26 Correct 68 ms 2204 KB Output is correct
27 Correct 65 ms 2204 KB Output is correct
28 Correct 68 ms 2252 KB Output is correct
29 Correct 66 ms 2200 KB Output is correct
30 Correct 38 ms 1400 KB Output is correct
31 Correct 0 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct