# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1091036 |
2024-09-19T14:39:46 Z |
Nurislam |
Gap (APIO16_gap) |
C++17 |
|
51 ms |
2480 KB |
#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;
vector<ll> a;
void so(ll l, ll r, int n){
ll mn = 1, mx = 1;
MinMax(l, r, &mn, &mx);
if(mn == -1)return;
a.pb(mn);
if(mx != mn)a.pb(mx);
if(mn == mx || a.size() >= n)return;
l = mn+1;
r = mx-1;
ll m = (r+l)>>1;
so(l, m, n);
so(m+1, r, n);
}
long long findGap(int t, int n)
{
so(0, 1e18, n);
sort(all(a));
ll ans = 1;
for(int i = 1; i < a.size(); i++)
ans = max(ans, a[i] - a[i-1]);
return ans;
}
Compilation message
gap.cpp: In function 'void so(ll, ll, int)':
gap.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(mn == mx || a.size() >= n)return;
| ~~~~~~~~~^~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(int i = 1; i < a.size(); i++)
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
1 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 |
Runtime error |
1 ms |
344 KB |
Execution failed because the return code was nonzero |
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 |
1 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
9 ms |
980 KB |
Output isn't correct |
17 |
Incorrect |
10 ms |
864 KB |
Output isn't correct |
18 |
Incorrect |
13 ms |
980 KB |
Output isn't correct |
19 |
Incorrect |
10 ms |
980 KB |
Output isn't correct |
20 |
Runtime error |
2 ms |
600 KB |
Execution failed because the return code was nonzero |
21 |
Incorrect |
48 ms |
2220 KB |
Output isn't correct |
22 |
Incorrect |
45 ms |
2480 KB |
Output isn't correct |
23 |
Incorrect |
50 ms |
2248 KB |
Output isn't correct |
24 |
Incorrect |
40 ms |
2248 KB |
Output isn't correct |
25 |
Incorrect |
34 ms |
2212 KB |
Output isn't correct |
26 |
Incorrect |
40 ms |
2256 KB |
Output isn't correct |
27 |
Incorrect |
49 ms |
2256 KB |
Output isn't correct |
28 |
Incorrect |
45 ms |
2168 KB |
Output isn't correct |
29 |
Incorrect |
39 ms |
2248 KB |
Output isn't correct |
30 |
Runtime error |
11 ms |
1204 KB |
Execution failed because the return code was nonzero |
31 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
32 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Partially correct |
0 ms |
344 KB |
Partially correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Partially correct |
1 ms |
344 KB |
Partially correct |
5 |
Partially correct |
0 ms |
344 KB |
Partially correct |
6 |
Partially correct |
0 ms |
344 KB |
Partially correct |
7 |
Partially correct |
0 ms |
344 KB |
Partially correct |
8 |
Partially correct |
0 ms |
344 KB |
Partially correct |
9 |
Partially correct |
0 ms |
344 KB |
Partially correct |
10 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |
11 |
Partially correct |
1 ms |
344 KB |
Partially correct |
12 |
Partially correct |
1 ms |
344 KB |
Partially correct |
13 |
Partially correct |
1 ms |
344 KB |
Partially correct |
14 |
Partially correct |
1 ms |
344 KB |
Partially correct |
15 |
Partially correct |
1 ms |
344 KB |
Partially correct |
16 |
Partially correct |
9 ms |
856 KB |
Partially correct |
17 |
Partially correct |
10 ms |
980 KB |
Partially correct |
18 |
Partially correct |
10 ms |
1028 KB |
Partially correct |
19 |
Partially correct |
11 ms |
980 KB |
Partially correct |
20 |
Runtime error |
2 ms |
600 KB |
Execution failed because the return code was nonzero |
21 |
Partially correct |
42 ms |
2272 KB |
Partially correct |
22 |
Partially correct |
43 ms |
2428 KB |
Partially correct |
23 |
Partially correct |
40 ms |
2256 KB |
Partially correct |
24 |
Partially correct |
39 ms |
2256 KB |
Partially correct |
25 |
Partially correct |
35 ms |
2256 KB |
Partially correct |
26 |
Partially correct |
51 ms |
2248 KB |
Partially correct |
27 |
Partially correct |
40 ms |
2332 KB |
Partially correct |
28 |
Partially correct |
43 ms |
2356 KB |
Partially correct |
29 |
Partially correct |
39 ms |
2228 KB |
Partially correct |
30 |
Runtime error |
7 ms |
1112 KB |
Execution failed because the return code was nonzero |
31 |
Partially correct |
0 ms |
344 KB |
Partially correct |
32 |
Runtime error |
0 ms |
344 KB |
Execution failed because the return code was nonzero |