#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const ll MAXA = 1000000000000000000LLU;
ll mn, mx;
ll solve(ll lo, ll hi){
if(lo >= hi) return 0;
unsigned long long x = (1LLU * lo + hi) / 2;
ll mid = (ll)(x), mn1 = -1, mx1 = -1, mn2 = -1, mx2 = -1;
MinMax(lo, mid, &mn1, &mx1);
if(mid < hi) MinMax(mid + 1, hi, &mn2, &mx2);
ll res = 0, r1 = 0, r2 = 0;
if(mx1 != -1 && mx2 != -1) res = mn2 - mx1;
if(mx2 != -1) r2 = solve(mid + 1, hi);
if(mx1 != -1) r1 = solve(lo, mid);
return max({res, r1, r2});
}
long long findGap(int T, int N){
return solve(0, MAXA);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
380 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
428 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
428 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
428 KB |
Output isn't correct |
6 |
Incorrect |
5 ms |
480 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
512 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
756 KB |
Output isn't correct |
11 |
Incorrect |
26 ms |
756 KB |
Output isn't correct |
12 |
Incorrect |
23 ms |
756 KB |
Output isn't correct |
13 |
Incorrect |
23 ms |
756 KB |
Output isn't correct |
14 |
Incorrect |
26 ms |
756 KB |
Output isn't correct |
15 |
Incorrect |
13 ms |
756 KB |
Output isn't correct |
16 |
Incorrect |
457 ms |
756 KB |
Output isn't correct |
17 |
Incorrect |
466 ms |
776 KB |
Output isn't correct |
18 |
Incorrect |
439 ms |
776 KB |
Output isn't correct |
19 |
Incorrect |
460 ms |
776 KB |
Output isn't correct |
20 |
Incorrect |
30 ms |
776 KB |
Output isn't correct |
21 |
Incorrect |
1992 ms |
1364 KB |
Output isn't correct |
22 |
Execution timed out |
2047 ms |
1364 KB |
Time limit exceeded |
23 |
Execution timed out |
2039 ms |
1448 KB |
Time limit exceeded |
24 |
Execution timed out |
2016 ms |
1448 KB |
Time limit exceeded |
25 |
Incorrect |
1092 ms |
1448 KB |
Output isn't correct |
26 |
Execution timed out |
2057 ms |
1448 KB |
Time limit exceeded |
27 |
Incorrect |
1946 ms |
1508 KB |
Output isn't correct |
28 |
Incorrect |
1913 ms |
1508 KB |
Output isn't correct |
29 |
Incorrect |
1921 ms |
1508 KB |
Output isn't correct |
30 |
Incorrect |
113 ms |
1508 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
1508 KB |
Output isn't correct |
32 |
Incorrect |
3 ms |
1508 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
1508 KB |
Partially correct |
2 |
Partially correct |
2 ms |
1508 KB |
Partially correct |
3 |
Partially correct |
2 ms |
1508 KB |
Partially correct |
4 |
Partially correct |
3 ms |
1508 KB |
Partially correct |
5 |
Partially correct |
2 ms |
1508 KB |
Partially correct |
6 |
Partially correct |
4 ms |
1508 KB |
Partially correct |
7 |
Partially correct |
4 ms |
1508 KB |
Partially correct |
8 |
Partially correct |
4 ms |
1508 KB |
Partially correct |
9 |
Partially correct |
3 ms |
1508 KB |
Partially correct |
10 |
Partially correct |
2 ms |
1508 KB |
Partially correct |
11 |
Partially correct |
24 ms |
1508 KB |
Partially correct |
12 |
Partially correct |
24 ms |
1508 KB |
Partially correct |
13 |
Partially correct |
26 ms |
1508 KB |
Partially correct |
14 |
Partially correct |
24 ms |
1508 KB |
Partially correct |
15 |
Partially correct |
13 ms |
1508 KB |
Partially correct |
16 |
Partially correct |
445 ms |
1508 KB |
Partially correct |
17 |
Partially correct |
471 ms |
1508 KB |
Partially correct |
18 |
Partially correct |
488 ms |
1508 KB |
Partially correct |
19 |
Partially correct |
443 ms |
1508 KB |
Partially correct |
20 |
Partially correct |
29 ms |
1508 KB |
Partially correct |
21 |
Partially correct |
1953 ms |
1508 KB |
Partially correct |
22 |
Execution timed out |
2003 ms |
1532 KB |
Time limit exceeded |
23 |
Execution timed out |
2047 ms |
1532 KB |
Time limit exceeded |
24 |
Execution timed out |
2064 ms |
1532 KB |
Time limit exceeded |
25 |
Partially correct |
996 ms |
1532 KB |
Partially correct |
26 |
Partially correct |
1982 ms |
1532 KB |
Partially correct |
27 |
Partially correct |
1964 ms |
1532 KB |
Partially correct |
28 |
Execution timed out |
2005 ms |
1532 KB |
Time limit exceeded |
29 |
Partially correct |
1964 ms |
1536 KB |
Partially correct |
30 |
Partially correct |
115 ms |
1536 KB |
Partially correct |
31 |
Partially correct |
2 ms |
1536 KB |
Partially correct |
32 |
Partially correct |
4 ms |
1536 KB |
Partially correct |