#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;
}
long long findGap(int T, int N)
{
pii x = query(1 , 1e18);
ll mi = x.first , ma = x.second;
ll gap = (ma-mi+N-2)/(N-1);
vector<int> v;
for (int i = mi; i <= ma; i += gap+1) {
pii ret=query(i , i+gap);
v.push_back(ret.first); v.push_back(ret.second);
}
int 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:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for (int i = 0; i < v.size()-1; i++) ans = max(ans , v[i+1]-v[i]);
| ~~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
658 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
1073 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
996 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
1096 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
6 |
Runtime error |
1543 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
1475 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
1561 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
1513 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Execution timed out |
2453 ms |
524288 KB |
Time limit exceeded |
12 |
Execution timed out |
2436 ms |
524288 KB |
Time limit exceeded |
13 |
Execution timed out |
2486 ms |
524288 KB |
Time limit exceeded |
14 |
Execution timed out |
2406 ms |
524288 KB |
Time limit exceeded |
15 |
Execution timed out |
3079 ms |
263192 KB |
Time limit exceeded |
16 |
Execution timed out |
3065 ms |
263336 KB |
Time limit exceeded |
17 |
Execution timed out |
3083 ms |
263388 KB |
Time limit exceeded |
18 |
Execution timed out |
3073 ms |
263340 KB |
Time limit exceeded |
19 |
Execution timed out |
3053 ms |
263252 KB |
Time limit exceeded |
20 |
Incorrect |
5 ms |
980 KB |
Output isn't correct |
21 |
Execution timed out |
3066 ms |
263960 KB |
Time limit exceeded |
22 |
Execution timed out |
3055 ms |
263792 KB |
Time limit exceeded |
23 |
Execution timed out |
3053 ms |
263848 KB |
Time limit exceeded |
24 |
Execution timed out |
3049 ms |
264012 KB |
Time limit exceeded |
25 |
Execution timed out |
3027 ms |
263876 KB |
Time limit exceeded |
26 |
Execution timed out |
3049 ms |
263848 KB |
Time limit exceeded |
27 |
Execution timed out |
3030 ms |
263848 KB |
Time limit exceeded |
28 |
Execution timed out |
3067 ms |
263948 KB |
Time limit exceeded |
29 |
Execution timed out |
3028 ms |
263988 KB |
Time limit exceeded |
30 |
Incorrect |
22 ms |
2252 KB |
Output isn't correct |
31 |
Runtime error |
1852 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
1621 ms |
524288 KB |
Execution killed with signal 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
752 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
1004 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
1024 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
1037 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Runtime error |
1532 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
1655 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
1515 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
1594 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
11 |
Execution timed out |
2320 ms |
524288 KB |
Time limit exceeded |
12 |
Execution timed out |
2410 ms |
524288 KB |
Time limit exceeded |
13 |
Execution timed out |
2418 ms |
524288 KB |
Time limit exceeded |
14 |
Execution timed out |
2365 ms |
524292 KB |
Time limit exceeded |
15 |
Execution timed out |
3053 ms |
263152 KB |
Time limit exceeded |
16 |
Execution timed out |
3076 ms |
263280 KB |
Time limit exceeded |
17 |
Execution timed out |
3061 ms |
263492 KB |
Time limit exceeded |
18 |
Execution timed out |
3044 ms |
263328 KB |
Time limit exceeded |
19 |
Execution timed out |
3044 ms |
263364 KB |
Time limit exceeded |
20 |
Incorrect |
5 ms |
856 KB |
Output isn't correct |
21 |
Execution timed out |
3067 ms |
263780 KB |
Time limit exceeded |
22 |
Execution timed out |
3036 ms |
263900 KB |
Time limit exceeded |
23 |
Execution timed out |
3057 ms |
263844 KB |
Time limit exceeded |
24 |
Execution timed out |
3034 ms |
263844 KB |
Time limit exceeded |
25 |
Execution timed out |
3038 ms |
263900 KB |
Time limit exceeded |
26 |
Execution timed out |
3066 ms |
263792 KB |
Time limit exceeded |
27 |
Execution timed out |
3055 ms |
263908 KB |
Time limit exceeded |
28 |
Execution timed out |
3112 ms |
263944 KB |
Time limit exceeded |
29 |
Execution timed out |
3026 ms |
263844 KB |
Time limit exceeded |
30 |
Incorrect |
24 ms |
2168 KB |
Output isn't correct |
31 |
Runtime error |
1799 ms |
524288 KB |
Execution killed with signal 9 |
32 |
Runtime error |
1710 ms |
524288 KB |
Execution killed with signal 9 |