#include <bits/stdc++.h>
#include "gap.h"
#define se second
#define fi first
using namespace std;
long long ans;
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 (mi1==-1 && mi2==-1) {
ans=max(ans,R-L);
return;
}
if (mi1==-1) {
ans=max(ans,mi2-L);
return;
}
if (mi2==-1) {
ans=max(ans,R-ma1);
return;
}
if (ma1-L>ans)
func(L,ma1);
if (R-mi2>ans)
func(mi2,R);
}
long long findGap(int T, int N)
{
int n=N;
long long Mn,Mx;
long long S=0;
long long TT=1000000000000000000;
MinMax(S,TT,&Mn,&Mx);
if (n==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 |
Memory limit exceeded |
1002 ms |
524288 KB |
Memory limit exceeded |
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 |
33 ms |
5140 KB |
Output isn't correct |
18 |
Incorrect |
33 ms |
5140 KB |
Output isn't correct |
19 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
20 |
Execution timed out |
2000 ms |
524288 KB |
Execution timed out |
21 |
Incorrect |
126 ms |
5140 KB |
Output isn't correct |
22 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
23 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
24 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
25 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
26 |
Incorrect |
126 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 |
126 ms |
5140 KB |
Output isn't correct |
30 |
Execution timed out |
2000 ms |
524288 KB |
Execution timed out |
31 |
Memory limit exceeded |
1046 ms |
524288 KB |
Memory limit exceeded |
32 |
Memory limit exceeded |
1123 ms |
524288 KB |
Memory limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
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 |
Memory limit exceeded |
1018 ms |
524288 KB |
Memory limit exceeded |
11 |
Incorrect |
3 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 |
3 ms |
5140 KB |
Output isn't correct |
16 |
Incorrect |
36 ms |
5140 KB |
Output isn't correct |
17 |
Incorrect |
36 ms |
5140 KB |
Output isn't correct |
18 |
Incorrect |
26 ms |
5140 KB |
Output isn't correct |
19 |
Incorrect |
29 ms |
5140 KB |
Output isn't correct |
20 |
Execution timed out |
2000 ms |
524288 KB |
Execution timed out |
21 |
Incorrect |
126 ms |
5140 KB |
Output isn't correct |
22 |
Incorrect |
149 ms |
5140 KB |
Output isn't correct |
23 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
24 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
25 |
Incorrect |
136 ms |
5140 KB |
Output isn't correct |
26 |
Incorrect |
129 ms |
5140 KB |
Output isn't correct |
27 |
Incorrect |
126 ms |
5140 KB |
Output isn't correct |
28 |
Incorrect |
133 ms |
5140 KB |
Output isn't correct |
29 |
Incorrect |
139 ms |
5140 KB |
Output isn't correct |
30 |
Execution timed out |
2000 ms |
505924 KB |
Execution timed out |
31 |
Memory limit exceeded |
1029 ms |
524288 KB |
Memory limit exceeded |
32 |
Memory limit exceeded |
1223 ms |
524288 KB |
Memory limit exceeded |