# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
42853 |
2018-03-05T13:50:07 Z |
fefe |
Gap (APIO16_gap) |
C++14 |
|
68 ms |
1392 KB |
#include "gap.h"
#include<stack>
#include<stdio.h>
#define f MinMax
#define max(x,y) ((x)>(y)?(x):(y))
using namespace std;
long long findGap(int T, int N)
{
long long s,e,ps,pe,maxx=0,x,y;
if(T==1){
f(0,(1LL<<62),&ps,&pe);
N-=2;
while(N>=2){
f(ps+1,pe-1,&s,&e);
N-=2;
maxx=max(maxx,max(s-ps,pe-e));
ps=s;pe=e;
}
if(N==1){
f(ps+1,pe-1,&s,&e);
return max(maxx,max(s-ps,pe-e));
}
return max(maxx,pe-ps);
}
f(0,(1LL<<62),&ps,&pe);
x=(pe-ps)/N;
if((pe-ps)%N) x++;
while(ps!=pe){
while(1){
f(ps+1,ps+x,&s,&e);
if(s!=-1) break;
x*=2;
}
maxx=max(maxx,s-ps);
ps=e;
}
return maxx;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:9:31: warning: unused variable 'y' [-Wunused-variable]
long long s,e,ps,pe,maxx=0,x,y;
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
480 KB |
Output is correct |
3 |
Correct |
2 ms |
480 KB |
Output is correct |
4 |
Correct |
1 ms |
480 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
1 ms |
548 KB |
Output is correct |
7 |
Correct |
1 ms |
548 KB |
Output is correct |
8 |
Correct |
1 ms |
568 KB |
Output is correct |
9 |
Correct |
2 ms |
568 KB |
Output is correct |
10 |
Correct |
1 ms |
568 KB |
Output is correct |
11 |
Correct |
2 ms |
568 KB |
Output is correct |
12 |
Correct |
2 ms |
604 KB |
Output is correct |
13 |
Correct |
3 ms |
620 KB |
Output is correct |
14 |
Correct |
2 ms |
740 KB |
Output is correct |
15 |
Correct |
2 ms |
740 KB |
Output is correct |
16 |
Correct |
15 ms |
748 KB |
Output is correct |
17 |
Correct |
15 ms |
748 KB |
Output is correct |
18 |
Correct |
15 ms |
748 KB |
Output is correct |
19 |
Correct |
15 ms |
748 KB |
Output is correct |
20 |
Correct |
11 ms |
772 KB |
Output is correct |
21 |
Correct |
54 ms |
1388 KB |
Output is correct |
22 |
Correct |
58 ms |
1392 KB |
Output is correct |
23 |
Correct |
57 ms |
1392 KB |
Output is correct |
24 |
Correct |
54 ms |
1392 KB |
Output is correct |
25 |
Correct |
46 ms |
1392 KB |
Output is correct |
26 |
Correct |
53 ms |
1392 KB |
Output is correct |
27 |
Correct |
55 ms |
1392 KB |
Output is correct |
28 |
Correct |
56 ms |
1392 KB |
Output is correct |
29 |
Correct |
55 ms |
1392 KB |
Output is correct |
30 |
Correct |
40 ms |
1392 KB |
Output is correct |
31 |
Correct |
2 ms |
1392 KB |
Output is correct |
32 |
Correct |
2 ms |
1392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1392 KB |
Output is correct |
2 |
Correct |
1 ms |
1392 KB |
Output is correct |
3 |
Correct |
1 ms |
1392 KB |
Output is correct |
4 |
Correct |
2 ms |
1392 KB |
Output is correct |
5 |
Correct |
1 ms |
1392 KB |
Output is correct |
6 |
Correct |
2 ms |
1392 KB |
Output is correct |
7 |
Correct |
1 ms |
1392 KB |
Output is correct |
8 |
Correct |
1 ms |
1392 KB |
Output is correct |
9 |
Correct |
1 ms |
1392 KB |
Output is correct |
10 |
Correct |
2 ms |
1392 KB |
Output is correct |
11 |
Correct |
2 ms |
1392 KB |
Output is correct |
12 |
Correct |
2 ms |
1392 KB |
Output is correct |
13 |
Correct |
2 ms |
1392 KB |
Output is correct |
14 |
Correct |
2 ms |
1392 KB |
Output is correct |
15 |
Correct |
2 ms |
1392 KB |
Output is correct |
16 |
Correct |
10 ms |
1392 KB |
Output is correct |
17 |
Incorrect |
10 ms |
1392 KB |
Output isn't correct |
18 |
Correct |
13 ms |
1392 KB |
Output is correct |
19 |
Correct |
9 ms |
1392 KB |
Output is correct |
20 |
Correct |
6 ms |
1392 KB |
Output is correct |
21 |
Correct |
43 ms |
1392 KB |
Output is correct |
22 |
Correct |
36 ms |
1392 KB |
Output is correct |
23 |
Correct |
41 ms |
1392 KB |
Output is correct |
24 |
Correct |
37 ms |
1392 KB |
Output is correct |
25 |
Correct |
68 ms |
1392 KB |
Output is correct |
26 |
Correct |
54 ms |
1392 KB |
Output is correct |
27 |
Incorrect |
34 ms |
1392 KB |
Output isn't correct |
28 |
Correct |
35 ms |
1392 KB |
Output is correct |
29 |
Correct |
36 ms |
1392 KB |
Output is correct |
30 |
Correct |
16 ms |
1392 KB |
Output is correct |
31 |
Correct |
2 ms |
1392 KB |
Output is correct |
32 |
Correct |
2 ms |
1392 KB |
Output is correct |