// start time: 21.07
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 100111
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
ll findGap(int T, int N){
if(T == 1){
set<ll> s;
ll l = 0, d = INF, x, y;
while(s.size() < N){
MinMax(l, d, &x, &y);
if(x != -1)
s.insert(x);
if(y != -1)
s.insert(y);
l = x + 1;
d = y - 1;
}
ll ans = -1;
for(auto it = s.begin(); next(it) != s.end(); it++)
ans = max(ans, *next(it) - *it);
return ans;
}
return 0;
}
Compilation message
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:24:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(s.size() < N){
~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
500 KB |
Output is correct |
3 |
Correct |
3 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
600 KB |
Output is correct |
5 |
Correct |
2 ms |
600 KB |
Output is correct |
6 |
Correct |
3 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
600 KB |
Output is correct |
8 |
Correct |
4 ms |
600 KB |
Output is correct |
9 |
Correct |
4 ms |
648 KB |
Output is correct |
10 |
Correct |
3 ms |
760 KB |
Output is correct |
11 |
Correct |
4 ms |
784 KB |
Output is correct |
12 |
Correct |
5 ms |
784 KB |
Output is correct |
13 |
Correct |
4 ms |
784 KB |
Output is correct |
14 |
Correct |
5 ms |
1056 KB |
Output is correct |
15 |
Correct |
4 ms |
1056 KB |
Output is correct |
16 |
Correct |
26 ms |
2724 KB |
Output is correct |
17 |
Correct |
25 ms |
3204 KB |
Output is correct |
18 |
Correct |
25 ms |
3668 KB |
Output is correct |
19 |
Correct |
27 ms |
4132 KB |
Output is correct |
20 |
Correct |
24 ms |
4300 KB |
Output is correct |
21 |
Correct |
103 ms |
10204 KB |
Output is correct |
22 |
Correct |
108 ms |
12276 KB |
Output is correct |
23 |
Correct |
107 ms |
13912 KB |
Output is correct |
24 |
Correct |
104 ms |
15852 KB |
Output is correct |
25 |
Correct |
96 ms |
16992 KB |
Output is correct |
26 |
Correct |
107 ms |
18800 KB |
Output is correct |
27 |
Correct |
110 ms |
20652 KB |
Output is correct |
28 |
Correct |
101 ms |
22528 KB |
Output is correct |
29 |
Correct |
103 ms |
24396 KB |
Output is correct |
30 |
Correct |
84 ms |
25112 KB |
Output is correct |
31 |
Correct |
3 ms |
25112 KB |
Output is correct |
32 |
Correct |
4 ms |
25112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
25112 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
25112 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
25112 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
25112 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
25112 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
11 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
14 |
Incorrect |
4 ms |
25112 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
25112 KB |
Output isn't correct |
16 |
Incorrect |
12 ms |
25112 KB |
Output isn't correct |
17 |
Incorrect |
14 ms |
25112 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
25112 KB |
Output isn't correct |
19 |
Incorrect |
12 ms |
25112 KB |
Output isn't correct |
20 |
Incorrect |
7 ms |
25112 KB |
Output isn't correct |
21 |
Incorrect |
37 ms |
25112 KB |
Output isn't correct |
22 |
Incorrect |
37 ms |
26240 KB |
Output isn't correct |
23 |
Incorrect |
34 ms |
28084 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
29928 KB |
Output isn't correct |
25 |
Incorrect |
26 ms |
31132 KB |
Output isn't correct |
26 |
Incorrect |
44 ms |
33028 KB |
Output isn't correct |
27 |
Incorrect |
34 ms |
34812 KB |
Output isn't correct |
28 |
Incorrect |
37 ms |
36692 KB |
Output isn't correct |
29 |
Incorrect |
39 ms |
38552 KB |
Output isn't correct |
30 |
Incorrect |
20 ms |
39260 KB |
Output isn't correct |
31 |
Incorrect |
3 ms |
39260 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
39260 KB |
Output isn't correct |