# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
554169 |
2022-04-27T18:27:18 Z |
QwertyPi |
Gap (APIO16_gap) |
C++14 |
|
94 ms |
5796 KB |
#include "gap.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
long long findGap(int T, int N)
{
ll ans = 0;
if(T == 1){
ll L = -1, R = (ll) 1e18+1;
set<ll> a;
for(int j = 0; j < (N + 1) / 2; j++){
MinMax(L + 1, R - 1, &L, &R);
if(L != -1) a.insert(L); if(R != -1) a.insert(R);
}
for(auto it = a.begin(); it != a.end(); it++){
if(next(it) != a.end()) ans = max(ans, *next(it) - *it);
}
}else{
ll L, R;
MinMax(0, 1e18, &L, &R);
ll tg = 1 + (R - L - 1) / (N - 1);
set<ll> a; a.insert(L); a.insert(R);
for(ll i = L + 1; i < R; i += tg){
ll ll, rr;
MinMax(i, min(R - 1, i + tg - 1), &ll, &rr);
if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
}
for(auto it = a.begin(); it != a.end(); it++){
if(next(it) != a.end()) ans = max(ans, *next(it) - *it);
}
}
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
13 | if(L != -1) a.insert(L); if(R != -1) a.insert(R);
| ^~
gap.cpp:13:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
13 | if(L != -1) a.insert(L); if(R != -1) a.insert(R);
| ^~
gap.cpp:26:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
26 | if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
| ^~
gap.cpp:26:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
26 | if(ll != -1) a.insert(ll); if(rr != -1) a.insert(rr);
| ^~
# |
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 |
1 ms |
208 KB |
Output is correct |
6 |
Correct |
1 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 |
13 ms |
1572 KB |
Output is correct |
17 |
Correct |
14 ms |
1640 KB |
Output is correct |
18 |
Correct |
13 ms |
1580 KB |
Output is correct |
19 |
Correct |
14 ms |
1576 KB |
Output is correct |
20 |
Correct |
14 ms |
1616 KB |
Output is correct |
21 |
Correct |
70 ms |
5796 KB |
Output is correct |
22 |
Correct |
58 ms |
5700 KB |
Output is correct |
23 |
Correct |
61 ms |
5704 KB |
Output is correct |
24 |
Correct |
60 ms |
5756 KB |
Output is correct |
25 |
Correct |
61 ms |
5736 KB |
Output is correct |
26 |
Correct |
60 ms |
5724 KB |
Output is correct |
27 |
Correct |
57 ms |
5772 KB |
Output is correct |
28 |
Correct |
65 ms |
5740 KB |
Output is correct |
29 |
Correct |
68 ms |
5680 KB |
Output is correct |
30 |
Correct |
50 ms |
5672 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 |
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 |
2 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 |
18 ms |
1492 KB |
Output is correct |
17 |
Correct |
18 ms |
1488 KB |
Output is correct |
18 |
Correct |
18 ms |
1520 KB |
Output is correct |
19 |
Correct |
18 ms |
1556 KB |
Output is correct |
20 |
Correct |
7 ms |
544 KB |
Output is correct |
21 |
Correct |
94 ms |
5268 KB |
Output is correct |
22 |
Correct |
79 ms |
5180 KB |
Output is correct |
23 |
Correct |
83 ms |
5292 KB |
Output is correct |
24 |
Correct |
75 ms |
5164 KB |
Output is correct |
25 |
Correct |
83 ms |
5728 KB |
Output is correct |
26 |
Correct |
80 ms |
5240 KB |
Output is correct |
27 |
Correct |
78 ms |
5196 KB |
Output is correct |
28 |
Correct |
75 ms |
5256 KB |
Output is correct |
29 |
Correct |
74 ms |
5280 KB |
Output is correct |
30 |
Correct |
41 ms |
1828 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
0 ms |
208 KB |
Output is correct |