#include "gap.h"
#include <bits/stdc++.h>
// #include "grader.cpp"
using namespace std;
// long long solve(){
// }
long long findGap(int T, int N)
{
// if(T==1)
// return solve(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:17:12: warning: unused variable 'ans' [-Wunused-variable]
17 | 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 |
0 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 |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Correct |
5 ms |
600 KB |
Output is correct |
17 |
Correct |
4 ms |
600 KB |
Output is correct |
18 |
Correct |
6 ms |
600 KB |
Output is correct |
19 |
Correct |
7 ms |
600 KB |
Output is correct |
20 |
Incorrect |
4 ms |
600 KB |
Output isn't correct |
21 |
Correct |
16 ms |
1104 KB |
Output is correct |
22 |
Correct |
17 ms |
1112 KB |
Output is correct |
23 |
Correct |
16 ms |
1100 KB |
Output is correct |
24 |
Correct |
21 ms |
1108 KB |
Output is correct |
25 |
Incorrect |
34 ms |
1112 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 |
14 ms |
1200 KB |
Output is correct |
29 |
Correct |
19 ms |
1112 KB |
Output is correct |
30 |
Incorrect |
16 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 |
1 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 |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
7 ms |
600 KB |
Output is correct |
17 |
Correct |
4 ms |
600 KB |
Output is correct |
18 |
Correct |
6 ms |
644 KB |
Output is correct |
19 |
Correct |
7 ms |
892 KB |
Output is correct |
20 |
Correct |
3 ms |
600 KB |
Output is correct |
21 |
Correct |
19 ms |
1112 KB |
Output is correct |
22 |
Correct |
17 ms |
1112 KB |
Output is correct |
23 |
Correct |
15 ms |
1112 KB |
Output is correct |
24 |
Correct |
13 ms |
1112 KB |
Output is correct |
25 |
Correct |
39 ms |
1112 KB |
Output is correct |
26 |
Correct |
24 ms |
1112 KB |
Output is correct |
27 |
Correct |
14 ms |
1112 KB |
Output is correct |
28 |
Correct |
14 ms |
1112 KB |
Output is correct |
29 |
Correct |
14 ms |
1112 KB |
Output is correct |
30 |
Correct |
15 ms |
1112 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |