#include "gap.h"
#include <bits/stdc++.h>
#define pii pair<ll,ll>
#define ll long long
using namespace std;
pii query(ll s , ll e) {
pii ret;
MinMax(s , e , &ret.first , &ret.second);
return ret;
}
vector<ll> v;
long long findGap(int T, int N)
{
pii x = query(0 , 2e18);
ll mi = x.first , ma = x.second;
ll gap = (ma-mi+N-2)/(N-1);
for (int i = mi; i <= ma; i += gap+1) {
pii ret=query(i , i+gap);
if (ret.first!=-1) v.push_back(ret.first);
if (ret.second!=-1) v.push_back(ret.second);
}
ll ans=0;
for (int i = 0; i < v.size()-1; i++) ans = max(ans , v[i+1]-v[i]);
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for (int i = 0; i < v.size()-1; i++) ans = max(ans , v[i+1]-v[i]);
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
482 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
648 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
657 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
674 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
6 |
Runtime error |
975 ms |
524292 KB |
Execution killed with signal 9 |
7 |
Runtime error |
881 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
946 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Execution timed out |
3037 ms |
344 KB |
Time limit exceeded |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Runtime error |
1390 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Runtime error |
1389 ms |
524288 KB |
Execution killed with signal 9 |
13 |
Runtime error |
1363 ms |
524288 KB |
Execution killed with signal 9 |
14 |
Runtime error |
1407 ms |
524288 KB |
Execution killed with signal 9 |
15 |
Execution timed out |
3081 ms |
263232 KB |
Time limit exceeded |
16 |
Runtime error |
1987 ms |
524288 KB |
Execution killed with signal 9 |
17 |
Execution timed out |
3037 ms |
600 KB |
Time limit exceeded |
18 |
Runtime error |
1915 ms |
524288 KB |
Execution killed with signal 9 |
19 |
Runtime error |
1881 ms |
524288 KB |
Execution killed with signal 9 |
20 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
21 |
Execution timed out |
2201 ms |
524288 KB |
Time limit exceeded |
22 |
Execution timed out |
3033 ms |
1112 KB |
Time limit exceeded |
23 |
Execution timed out |
2200 ms |
524288 KB |
Time limit exceeded |
24 |
Execution timed out |
3037 ms |
1112 KB |
Time limit exceeded |
25 |
Execution timed out |
3050 ms |
264004 KB |
Time limit exceeded |
26 |
Execution timed out |
3018 ms |
1112 KB |
Time limit exceeded |
27 |
Execution timed out |
3034 ms |
1112 KB |
Time limit exceeded |
28 |
Execution timed out |
2260 ms |
524288 KB |
Time limit exceeded |
29 |
Execution timed out |
3061 ms |
1112 KB |
Time limit exceeded |
30 |
Incorrect |
21 ms |
1624 KB |
Output isn't correct |
31 |
Runtime error |
1063 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
1629 ms |
524288 KB |
Execution killed with signal 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
526 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Execution timed out |
3026 ms |
344 KB |
Time limit exceeded |
3 |
Execution timed out |
3046 ms |
344 KB |
Time limit exceeded |
4 |
Runtime error |
659 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Runtime error |
912 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
972 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Execution timed out |
3054 ms |
344 KB |
Time limit exceeded |
9 |
Runtime error |
935 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Execution timed out |
3097 ms |
344 KB |
Time limit exceeded |
12 |
Runtime error |
1381 ms |
524288 KB |
Execution killed with signal 9 |
13 |
Runtime error |
1374 ms |
524288 KB |
Execution killed with signal 9 |
14 |
Runtime error |
1335 ms |
524288 KB |
Execution killed with signal 9 |
15 |
Execution timed out |
3036 ms |
263060 KB |
Time limit exceeded |
16 |
Execution timed out |
3062 ms |
600 KB |
Time limit exceeded |
17 |
Execution timed out |
3031 ms |
600 KB |
Time limit exceeded |
18 |
Execution timed out |
3025 ms |
600 KB |
Time limit exceeded |
19 |
Execution timed out |
3025 ms |
600 KB |
Time limit exceeded |
20 |
Correct |
5 ms |
600 KB |
Output is correct |
21 |
Execution timed out |
2257 ms |
524288 KB |
Time limit exceeded |
22 |
Execution timed out |
3042 ms |
1112 KB |
Time limit exceeded |
23 |
Execution timed out |
3042 ms |
1112 KB |
Time limit exceeded |
24 |
Execution timed out |
2277 ms |
524288 KB |
Time limit exceeded |
25 |
Execution timed out |
3034 ms |
263848 KB |
Time limit exceeded |
26 |
Execution timed out |
2233 ms |
524288 KB |
Time limit exceeded |
27 |
Execution timed out |
2169 ms |
524288 KB |
Time limit exceeded |
28 |
Execution timed out |
2230 ms |
524288 KB |
Time limit exceeded |
29 |
Execution timed out |
3061 ms |
1112 KB |
Time limit exceeded |
30 |
Correct |
20 ms |
1604 KB |
Output is correct |
31 |
Runtime error |
1040 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
1585 ms |
524288 KB |
Execution killed with signal 9 |