# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95692 |
2019-02-02T07:44:26 Z |
dwsc |
Gap (APIO16_gap) |
C++14 |
|
64 ms |
2044 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
if (T == 1){
long long arr[N];
long long x1,x2;
long long low = 0,high = 1e18;
for (int i = 0; i < (N+1)/2; i++){
MinMax(low,high,&x1,&x2);
arr[i] = x1,arr[N-i-1] = x2;
low = x1+1,high = x2-1;
}
long long ans = 0;
for (int i = 0; i < N-1; i++) ans = max(ans,arr[i+1]-arr[i]);
return ans;
}
long long low,high;
MinMax(0,1e18,&low,&high);
long long gap = (high-low+N-1)/(N-1);
long long prev = low;
long long ans = 0;
long long t1,t2;
for (long long lower = low; lower < high; lower += gap){
MinMax(lower+1,lower+gap,&t1,&t2);
// cout << lower << t1 << " " << t2 << "\n";
if (t1 != -1) ans = max(ans,t1-prev);
if (t2 != -1) prev = t2;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
380 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
13 ms |
760 KB |
Output is correct |
17 |
Correct |
12 ms |
760 KB |
Output is correct |
18 |
Correct |
13 ms |
760 KB |
Output is correct |
19 |
Correct |
13 ms |
760 KB |
Output is correct |
20 |
Correct |
10 ms |
760 KB |
Output is correct |
21 |
Correct |
47 ms |
1912 KB |
Output is correct |
22 |
Correct |
48 ms |
1884 KB |
Output is correct |
23 |
Correct |
46 ms |
1832 KB |
Output is correct |
24 |
Correct |
47 ms |
1912 KB |
Output is correct |
25 |
Correct |
41 ms |
1912 KB |
Output is correct |
26 |
Correct |
47 ms |
1912 KB |
Output is correct |
27 |
Correct |
47 ms |
1912 KB |
Output is correct |
28 |
Correct |
46 ms |
2040 KB |
Output is correct |
29 |
Correct |
47 ms |
1912 KB |
Output is correct |
30 |
Correct |
35 ms |
2044 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
3 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
380 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
380 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
17 ms |
504 KB |
Output is correct |
17 |
Correct |
16 ms |
504 KB |
Output is correct |
18 |
Correct |
16 ms |
504 KB |
Output is correct |
19 |
Correct |
16 ms |
504 KB |
Output is correct |
20 |
Correct |
8 ms |
504 KB |
Output is correct |
21 |
Correct |
62 ms |
1144 KB |
Output is correct |
22 |
Correct |
64 ms |
1144 KB |
Output is correct |
23 |
Correct |
64 ms |
1144 KB |
Output is correct |
24 |
Correct |
64 ms |
1144 KB |
Output is correct |
25 |
Correct |
57 ms |
1160 KB |
Output is correct |
26 |
Correct |
61 ms |
1144 KB |
Output is correct |
27 |
Correct |
62 ms |
1172 KB |
Output is correct |
28 |
Correct |
61 ms |
1148 KB |
Output is correct |
29 |
Correct |
63 ms |
1144 KB |
Output is correct |
30 |
Correct |
30 ms |
1144 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |