# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
44711 |
2018-04-05T11:34:10 Z |
faustaadp |
Gap (APIO16_gap) |
C++17 |
|
89 ms |
2724 KB |
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll ma,L,R,gm,i,LT,RT,a[101010];
vector<ll> v;
long long findGap(int T, int N)
{
if(T==1)
{
LT=-1;
RT=1e18+1;
for(i=1;i<=(N+1)/2;i++)
{
MinMax(LT+1,RT-1,<,&RT);
a[i]=LT;
a[N-i+1]=RT;
}
for(i=2;i<=N;i++)
ma=max(ma,a[i]-a[i-1]);
}
else
{
MinMax(0,(ll)1e18,&L,&R);
gm=(R-L)/(N-1);
for(i=L;i<R;i+=(gm+1))
{
MinMax(i,min(i+gm,R),<,&RT);
if(LT!=-1)
v.pb(LT);
if(LT!=RT)
v.pb(RT);
}
for(i=1;i<v.size();i++)
ma=max(ma,v[i]-v[i-1]);
}
return ma;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:38:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=1;i<v.size();i++)
~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is 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 |
512 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
692 KB |
Output is correct |
9 |
Correct |
2 ms |
748 KB |
Output is correct |
10 |
Correct |
2 ms |
748 KB |
Output is correct |
11 |
Correct |
3 ms |
748 KB |
Output is correct |
12 |
Correct |
3 ms |
748 KB |
Output is correct |
13 |
Correct |
2 ms |
748 KB |
Output is correct |
14 |
Correct |
2 ms |
748 KB |
Output is correct |
15 |
Correct |
2 ms |
748 KB |
Output is correct |
16 |
Correct |
16 ms |
1020 KB |
Output is correct |
17 |
Correct |
15 ms |
1020 KB |
Output is correct |
18 |
Correct |
21 ms |
1020 KB |
Output is correct |
19 |
Correct |
15 ms |
1020 KB |
Output is correct |
20 |
Correct |
11 ms |
1020 KB |
Output is correct |
21 |
Correct |
55 ms |
2144 KB |
Output is correct |
22 |
Correct |
63 ms |
2172 KB |
Output is correct |
23 |
Correct |
55 ms |
2172 KB |
Output is correct |
24 |
Correct |
63 ms |
2172 KB |
Output is correct |
25 |
Correct |
48 ms |
2172 KB |
Output is correct |
26 |
Correct |
55 ms |
2208 KB |
Output is correct |
27 |
Correct |
56 ms |
2208 KB |
Output is correct |
28 |
Correct |
57 ms |
2208 KB |
Output is correct |
29 |
Correct |
57 ms |
2208 KB |
Output is correct |
30 |
Correct |
41 ms |
2208 KB |
Output is correct |
31 |
Incorrect |
2 ms |
2208 KB |
Output isn't correct |
32 |
Correct |
2 ms |
2208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2208 KB |
Output is correct |
2 |
Correct |
2 ms |
2208 KB |
Output is correct |
3 |
Correct |
2 ms |
2208 KB |
Output is correct |
4 |
Correct |
2 ms |
2208 KB |
Output is correct |
5 |
Correct |
2 ms |
2208 KB |
Output is correct |
6 |
Correct |
2 ms |
2208 KB |
Output is correct |
7 |
Correct |
2 ms |
2208 KB |
Output is correct |
8 |
Correct |
2 ms |
2208 KB |
Output is correct |
9 |
Correct |
2 ms |
2208 KB |
Output is correct |
10 |
Correct |
2 ms |
2208 KB |
Output is correct |
11 |
Correct |
3 ms |
2208 KB |
Output is correct |
12 |
Correct |
3 ms |
2208 KB |
Output is correct |
13 |
Correct |
3 ms |
2208 KB |
Output is correct |
14 |
Correct |
3 ms |
2208 KB |
Output is correct |
15 |
Correct |
3 ms |
2208 KB |
Output is correct |
16 |
Correct |
20 ms |
2208 KB |
Output is correct |
17 |
Correct |
20 ms |
2208 KB |
Output is correct |
18 |
Correct |
20 ms |
2208 KB |
Output is correct |
19 |
Correct |
20 ms |
2208 KB |
Output is correct |
20 |
Correct |
10 ms |
2208 KB |
Output is correct |
21 |
Correct |
78 ms |
2568 KB |
Output is correct |
22 |
Correct |
80 ms |
2584 KB |
Output is correct |
23 |
Correct |
79 ms |
2724 KB |
Output is correct |
24 |
Correct |
78 ms |
2724 KB |
Output is correct |
25 |
Correct |
71 ms |
2724 KB |
Output is correct |
26 |
Correct |
76 ms |
2724 KB |
Output is correct |
27 |
Correct |
76 ms |
2724 KB |
Output is correct |
28 |
Correct |
89 ms |
2724 KB |
Output is correct |
29 |
Correct |
83 ms |
2724 KB |
Output is correct |
30 |
Correct |
48 ms |
2724 KB |
Output is correct |
31 |
Correct |
2 ms |
2724 KB |
Output is correct |
32 |
Correct |
2 ms |
2724 KB |
Output is correct |