# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
84382 |
2018-11-14T21:15:58 Z |
Alexa2001 |
Gap (APIO16_gap) |
C++17 |
|
89 ms |
21116 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll lim = 1e18;
long long findGap(int T, int N)
{
ll *A, *B;
ll ans = 0;
A = new ll(); B = new ll();
if(T == 1)
{
ll x = 0, y = lim;
int i;
for(i=0; i<(N+1)/2; ++i)
{
MinMax(x, y, A, B);
if(i)
{
ans = max(ans, *A - x + 1);
ans = max(ans, y - *B + 1);
}
x = *A + 1;
y = *B - 1;
}
return ans;
}
MinMax(0, lim, A, B);
ll X, Y;
X = *A, Y = *B;
ll i, S = (ll)( (Y-X+1) / N );
vector<ll> endpoints;
for(i = 0; i <= Y-X+1; i += S)
{
MinMax(X+i, X + min(i+S-1, Y-X+1), A, B);
if(*A == -1) continue;
endpoints.push_back(*A);
endpoints.push_back(*B);
}
int j;
for(j=0; j<endpoints.size()-1; ++j)
ans = max(ans, endpoints[j+1] - endpoints[j]);
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:48:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j=0; j<endpoints.size()-1; ++j)
~^~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
2 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
528 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
2 ms |
580 KB |
Output is correct |
9 |
Correct |
2 ms |
584 KB |
Output is correct |
10 |
Correct |
2 ms |
588 KB |
Output is correct |
11 |
Correct |
3 ms |
592 KB |
Output is correct |
12 |
Correct |
3 ms |
748 KB |
Output is correct |
13 |
Correct |
3 ms |
748 KB |
Output is correct |
14 |
Correct |
3 ms |
748 KB |
Output is correct |
15 |
Correct |
3 ms |
748 KB |
Output is correct |
16 |
Correct |
16 ms |
1400 KB |
Output is correct |
17 |
Correct |
15 ms |
1884 KB |
Output is correct |
18 |
Correct |
15 ms |
2368 KB |
Output is correct |
19 |
Correct |
15 ms |
2828 KB |
Output is correct |
20 |
Correct |
12 ms |
3140 KB |
Output is correct |
21 |
Correct |
57 ms |
5484 KB |
Output is correct |
22 |
Correct |
65 ms |
7332 KB |
Output is correct |
23 |
Correct |
59 ms |
9104 KB |
Output is correct |
24 |
Correct |
61 ms |
11080 KB |
Output is correct |
25 |
Correct |
49 ms |
12164 KB |
Output is correct |
26 |
Correct |
56 ms |
14020 KB |
Output is correct |
27 |
Correct |
57 ms |
15864 KB |
Output is correct |
28 |
Correct |
57 ms |
17708 KB |
Output is correct |
29 |
Correct |
57 ms |
19056 KB |
Output is correct |
30 |
Correct |
41 ms |
19056 KB |
Output is correct |
31 |
Correct |
2 ms |
19056 KB |
Output is correct |
32 |
Correct |
2 ms |
19056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
2 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
3 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
4 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
5 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
6 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
7 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
8 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
9 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
10 |
Partially correct |
2 ms |
19056 KB |
Partially correct |
11 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
12 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
13 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
14 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
15 |
Partially correct |
3 ms |
19056 KB |
Partially correct |
16 |
Partially correct |
22 ms |
19056 KB |
Partially correct |
17 |
Partially correct |
20 ms |
19056 KB |
Partially correct |
18 |
Partially correct |
20 ms |
19056 KB |
Partially correct |
19 |
Partially correct |
21 ms |
19056 KB |
Partially correct |
20 |
Partially correct |
10 ms |
19056 KB |
Partially correct |
21 |
Partially correct |
78 ms |
20096 KB |
Partially correct |
22 |
Partially correct |
79 ms |
20100 KB |
Partially correct |
23 |
Partially correct |
78 ms |
20100 KB |
Partially correct |
24 |
Partially correct |
82 ms |
20100 KB |
Partially correct |
25 |
Partially correct |
89 ms |
21116 KB |
Partially correct |
26 |
Partially correct |
80 ms |
21116 KB |
Partially correct |
27 |
Partially correct |
77 ms |
21116 KB |
Partially correct |
28 |
Partially correct |
84 ms |
21116 KB |
Partially correct |
29 |
Partially correct |
82 ms |
21116 KB |
Partially correct |
30 |
Partially correct |
41 ms |
21116 KB |
Partially correct |
31 |
Partially correct |
2 ms |
21116 KB |
Partially correct |
32 |
Partially correct |
2 ms |
21116 KB |
Partially correct |