#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#include "gap.h"
typedef long long ll;
ll solve1(int t, int n){
ll l = 0, r = 1e18;
vector<ll> a;
ll lf = 1, rf = 1;
while(lf != rf && a.size()*2 < n){
MinMax(l, r, &lf, &rf);
if(lf == -1)break;
a.pb(lf);
a.pb(rf);
l = lf+1, r = rf-1;
}
ll ans = 1;
sort(all(a));
for(int i = 1; i < a.size(); i++)
ans = max(ans, a[i] - a[i-1]);
return ans;
}
long long findGap(int t, int n)
{
//if(t == 1){
return solve1(t, n);
//}
return 0;
}
Compilation message
gap.cpp: In function 'll solve1(int, int)':
gap.cpp:18:31: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
18 | while(lf != rf && a.size()*2 < n){
| ~~~~~~~~~~~^~~
gap.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for(int i = 1; i < a.size(); i++)
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
17 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
18 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
600 KB |
Output isn't correct |
21 |
Incorrect |
13 ms |
1112 KB |
Output isn't correct |
22 |
Incorrect |
13 ms |
1112 KB |
Output isn't correct |
23 |
Incorrect |
15 ms |
1112 KB |
Output isn't correct |
24 |
Incorrect |
13 ms |
1112 KB |
Output isn't correct |
25 |
Incorrect |
14 ms |
1112 KB |
Output isn't correct |
26 |
Incorrect |
13 ms |
1112 KB |
Output isn't correct |
27 |
Incorrect |
13 ms |
1112 KB |
Output isn't correct |
28 |
Incorrect |
12 ms |
1116 KB |
Output isn't correct |
29 |
Incorrect |
20 ms |
1104 KB |
Output isn't correct |
30 |
Incorrect |
7 ms |
1112 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
356 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
436 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
600 KB |
Output isn't correct |
18 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
600 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
600 KB |
Output isn't correct |
21 |
Incorrect |
13 ms |
1224 KB |
Output isn't correct |
22 |
Incorrect |
21 ms |
1112 KB |
Output isn't correct |
23 |
Incorrect |
12 ms |
1112 KB |
Output isn't correct |
24 |
Incorrect |
12 ms |
1112 KB |
Output isn't correct |
25 |
Incorrect |
10 ms |
1112 KB |
Output isn't correct |
26 |
Incorrect |
12 ms |
1024 KB |
Output isn't correct |
27 |
Incorrect |
12 ms |
1112 KB |
Output isn't correct |
28 |
Incorrect |
12 ms |
1112 KB |
Output isn't correct |
29 |
Incorrect |
12 ms |
1112 KB |
Output isn't correct |
30 |
Incorrect |
8 ms |
1112 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |