#include <bits/stdc++.h>
//#include "grader.cpp"
#include "gap.h"
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define lol long long
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((lol)(1e15+100))
#define MX ((lol)(4e9+100))
#define ARRS ((lol)(1e6+100))
#define MOD ((lol)(1e9+7))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)
#define LG 21
long long findGap(int T, int n)
{
vector<ll> v;
ll k,p;
MinMax(0,1e18,&k,&p);
v.pb(k);
v.pb(p);
ll l=k+1,r=p-1;
ll t=(r-l)/2*n;
t=max(t,1ll);
for(ll i=l; i<=r; i+=t){
MinMax(i,min(r,i+t-1),&k,&p);
v.pb(k);
v.pb(p);
}
sort(v.begin(),v.end());
ll pas=0;
for(int i=1; i<v.size(); i++){
pas=max(pas,v[i]-v[i-1]);
}
return pas;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:43:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1; i<v.size(); i++){
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
360 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
568 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
568 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
568 KB |
Output isn't correct |
6 |
Runtime error |
1945 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
1753 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
1794 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
1860 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
11 |
Execution timed out |
2055 ms |
524288 KB |
Time limit exceeded |
12 |
Execution timed out |
2071 ms |
524288 KB |
Time limit exceeded |
13 |
Execution timed out |
2091 ms |
524288 KB |
Time limit exceeded |
14 |
Execution timed out |
2075 ms |
524288 KB |
Time limit exceeded |
15 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
16 |
Execution timed out |
2087 ms |
524288 KB |
Time limit exceeded |
17 |
Execution timed out |
2074 ms |
524288 KB |
Time limit exceeded |
18 |
Execution timed out |
2074 ms |
524288 KB |
Time limit exceeded |
19 |
Execution timed out |
2083 ms |
524288 KB |
Time limit exceeded |
20 |
Incorrect |
6 ms |
524288 KB |
Output isn't correct |
21 |
Incorrect |
37 ms |
524288 KB |
Output isn't correct |
22 |
Incorrect |
32 ms |
524288 KB |
Output isn't correct |
23 |
Incorrect |
32 ms |
524288 KB |
Output isn't correct |
24 |
Incorrect |
30 ms |
524288 KB |
Output isn't correct |
25 |
Incorrect |
21 ms |
524288 KB |
Output isn't correct |
26 |
Incorrect |
30 ms |
524288 KB |
Output isn't correct |
27 |
Incorrect |
30 ms |
524288 KB |
Output isn't correct |
28 |
Incorrect |
29 ms |
524288 KB |
Output isn't correct |
29 |
Incorrect |
29 ms |
524288 KB |
Output isn't correct |
30 |
Incorrect |
15 ms |
524288 KB |
Output isn't correct |
31 |
Correct |
2 ms |
524288 KB |
Output is correct |
32 |
Correct |
2 ms |
524288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
524288 KB |
Output is correct |
2 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
6 |
Runtime error |
2017 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
1818 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
1796 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
1781 ms |
524288 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
11 |
Execution timed out |
2088 ms |
524288 KB |
Time limit exceeded |
12 |
Execution timed out |
2089 ms |
524288 KB |
Time limit exceeded |
13 |
Execution timed out |
2083 ms |
524288 KB |
Time limit exceeded |
14 |
Execution timed out |
2081 ms |
524288 KB |
Time limit exceeded |
15 |
Incorrect |
2 ms |
524288 KB |
Output isn't correct |
16 |
Execution timed out |
2066 ms |
524288 KB |
Time limit exceeded |
17 |
Execution timed out |
2084 ms |
524288 KB |
Time limit exceeded |
18 |
Incorrect |
13 ms |
524288 KB |
Output isn't correct |
19 |
Execution timed out |
2077 ms |
524288 KB |
Time limit exceeded |
20 |
Incorrect |
5 ms |
524288 KB |
Output isn't correct |
21 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
22 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
23 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
24 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
25 |
Incorrect |
20 ms |
524288 KB |
Output isn't correct |
26 |
Execution timed out |
2071 ms |
524288 KB |
Time limit exceeded |
27 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
28 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
29 |
Incorrect |
28 ms |
524288 KB |
Output isn't correct |
30 |
Incorrect |
15 ms |
524288 KB |
Output isn't correct |
31 |
Correct |
1 ms |
524288 KB |
Output is correct |
32 |
Correct |
2 ms |
524288 KB |
Output is correct |