#include <bits/stdc++.h>
#include "gap.h"
#define se second
#define fi first
using namespace std;
long long ans=0;
void func (long long L,long long R)
{
long long mi1,ma1,mi2,ma2;
long long mid=(L+R)/2;
MinMax(L,mid,&mi1,&ma1);
MinMax(mid,R,&mi2,&ma2);
if (ma1==-1 && mi2==-1) {
ans=max(ans,R-L);
return;
}
if (ma1==-1) {
ans=max(ans,mi2-L);
return;
}
if (mi2==-1) {
ans=max(ans,R-ma1);
return;
}
if (R-L==1){
ans=max(ans,R-L);
return;
}
if (ma1-L>ans)
func(L,ma1);
if (R-mi2>ans)
func(mi2,R);
}
long long findGap(int T, int N)
{
int m=N;
long long Mn,Mx;
long long S=0;
long long TT=1000000000000000000;
MinMax(S,TT,&Mn,&Mx);
if (m==2)
return Mx-Mn;
ans=0;
func (Mn,Mx);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5140 KB |
Output is correct |
2 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
16 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
17 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
18 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
19 |
Incorrect |
33 ms |
5140 KB |
Output isn't correct |
20 |
Incorrect |
26 ms |
5140 KB |
Output isn't correct |
21 |
Incorrect |
133 ms |
5140 KB |
Output isn't correct |
22 |
Incorrect |
133 ms |
5140 KB |
Output isn't correct |
23 |
Incorrect |
126 ms |
5140 KB |
Output isn't correct |
24 |
Incorrect |
133 ms |
5140 KB |
Output isn't correct |
25 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
26 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
27 |
Incorrect |
116 ms |
5140 KB |
Output isn't correct |
28 |
Incorrect |
129 ms |
5140 KB |
Output isn't correct |
29 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
30 |
Incorrect |
113 ms |
5140 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
5140 KB |
Output is correct |
2 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
16 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
17 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
18 |
Incorrect |
36 ms |
5140 KB |
Output isn't correct |
19 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
20 |
Incorrect |
26 ms |
5140 KB |
Output isn't correct |
21 |
Incorrect |
123 ms |
5140 KB |
Output isn't correct |
22 |
Incorrect |
123 ms |
5140 KB |
Output isn't correct |
23 |
Incorrect |
146 ms |
5140 KB |
Output isn't correct |
24 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
25 |
Incorrect |
126 ms |
5140 KB |
Output isn't correct |
26 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
27 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
28 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
29 |
Incorrect |
129 ms |
5140 KB |
Output isn't correct |
30 |
Incorrect |
103 ms |
5140 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
5140 KB |
Output isn't correct |