#include "gap.h"
#include <bits/stdc++.h>
// #include "grader.cpp"
using namespace std;
long long findGap(int T, int N)
{
long long mn,mx;
long long s=0,t=1e18;
MinMax(s,t,&mn,&mx);
s=mn+1,t=mx;
long long gap=(t-s)/(N-1);
long long ans=0;
long long pre=mn;
while(s<t){
MinMax(s,min(s+gap,t),&mn,&mx);
if(mn==-1)
s+=gap;
else{
gap=max(gap,mn-pre);
s=mx+1;
pre=mx;
}
}
return gap;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:12:12: warning: unused variable 'ans' [-Wunused-variable]
12 | long long ans=0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 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 |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Correct |
7 ms |
600 KB |
Output is correct |
17 |
Correct |
5 ms |
600 KB |
Output is correct |
18 |
Correct |
7 ms |
600 KB |
Output is correct |
19 |
Correct |
7 ms |
820 KB |
Output is correct |
20 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
21 |
Correct |
17 ms |
1196 KB |
Output is correct |
22 |
Correct |
18 ms |
1112 KB |
Output is correct |
23 |
Correct |
16 ms |
1112 KB |
Output is correct |
24 |
Correct |
17 ms |
1112 KB |
Output is correct |
25 |
Incorrect |
32 ms |
1204 KB |
Output isn't correct |
26 |
Correct |
16 ms |
1112 KB |
Output is correct |
27 |
Correct |
16 ms |
1112 KB |
Output is correct |
28 |
Correct |
16 ms |
1364 KB |
Output is correct |
29 |
Correct |
20 ms |
1112 KB |
Output is correct |
30 |
Incorrect |
14 ms |
1112 KB |
Output isn't correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
4 ms |
436 KB |
Output is correct |
17 |
Correct |
4 ms |
600 KB |
Output is correct |
18 |
Correct |
7 ms |
516 KB |
Output is correct |
19 |
Correct |
4 ms |
596 KB |
Output is correct |
20 |
Correct |
3 ms |
648 KB |
Output is correct |
21 |
Correct |
25 ms |
1228 KB |
Output is correct |
22 |
Correct |
16 ms |
1236 KB |
Output is correct |
23 |
Correct |
16 ms |
1044 KB |
Output is correct |
24 |
Correct |
16 ms |
1112 KB |
Output is correct |
25 |
Correct |
32 ms |
1112 KB |
Output is correct |
26 |
Correct |
17 ms |
1112 KB |
Output is correct |
27 |
Correct |
22 ms |
1112 KB |
Output is correct |
28 |
Correct |
17 ms |
1236 KB |
Output is correct |
29 |
Correct |
17 ms |
1112 KB |
Output is correct |
30 |
Correct |
14 ms |
1112 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |