# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
163532 |
2019-11-13T17:56:58 Z |
Akashi |
Gap (APIO16_gap) |
C++14 |
|
115 ms |
5880 KB |
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
const long long INF = 1e18;
set <long long> s;
long long findGap(int T, int N){
if(T == 1){
s.clear();
long long L = 1, R = INF;
while(L != -1 && R != -1 && L <= R && N > 0){
long long x, y;
MinMax(L, R, &x, &y);
if(x != -1) s.insert(x), L = x + 1, --N;
else L = -1;
if(y != -1) s.insert(y), R = y - 1, --N;
else R = -1;
}
}
if(T == 2){
s.clear();
long long Min, Max;
MinMax(1, INF, &Min, &Max);
s.insert(Min); s.insert(Max);
long long L = (Max - Min + 1) / N + 1, x, y;
for(long long i = Min + 1; i < Max ; i = i + L){
MinMax(i, min(i + L - 1, Max), &x, &y);
if(x != -1) s.insert(x);
if(y != -1) s.insert(y);
}
}
long long Sol = 0;
set <long long> :: iterator it = s.begin();
set <long long> :: iterator it2 = next(it);
while(it2 != s.end()){
Sol = max(Sol, *it2 - *it);
++it2; ++it;
}
return Sol;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
296 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
3 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
22 ms |
1656 KB |
Output is correct |
17 |
Correct |
21 ms |
1784 KB |
Output is correct |
18 |
Correct |
21 ms |
1784 KB |
Output is correct |
19 |
Correct |
21 ms |
1656 KB |
Output is correct |
20 |
Correct |
17 ms |
1784 KB |
Output is correct |
21 |
Correct |
88 ms |
5872 KB |
Output is correct |
22 |
Correct |
87 ms |
5880 KB |
Output is correct |
23 |
Correct |
89 ms |
5848 KB |
Output is correct |
24 |
Correct |
89 ms |
5752 KB |
Output is correct |
25 |
Correct |
80 ms |
5760 KB |
Output is correct |
26 |
Correct |
95 ms |
5880 KB |
Output is correct |
27 |
Correct |
86 ms |
5752 KB |
Output is correct |
28 |
Correct |
88 ms |
5880 KB |
Output is correct |
29 |
Correct |
89 ms |
5880 KB |
Output is correct |
30 |
Correct |
73 ms |
5752 KB |
Output is correct |
31 |
Correct |
2 ms |
372 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
3 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
60 ms |
1548 KB |
Output is correct |
17 |
Correct |
26 ms |
1684 KB |
Output is correct |
18 |
Correct |
26 ms |
1528 KB |
Output is correct |
19 |
Correct |
26 ms |
1656 KB |
Output is correct |
20 |
Correct |
10 ms |
632 KB |
Output is correct |
21 |
Correct |
108 ms |
5340 KB |
Output is correct |
22 |
Correct |
108 ms |
5452 KB |
Output is correct |
23 |
Correct |
108 ms |
5240 KB |
Output is correct |
24 |
Correct |
108 ms |
5240 KB |
Output is correct |
25 |
Correct |
115 ms |
5752 KB |
Output is correct |
26 |
Correct |
111 ms |
5352 KB |
Output is correct |
27 |
Correct |
112 ms |
5240 KB |
Output is correct |
28 |
Correct |
109 ms |
5352 KB |
Output is correct |
29 |
Correct |
109 ms |
5272 KB |
Output is correct |
30 |
Correct |
43 ms |
1912 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |