# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
42683 |
2018-03-02T15:30:41 Z |
fefe |
Gap (APIO16_gap) |
C++14 |
|
74 ms |
3820 KB |
#include "gap.h"
#include<stack>
#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=0;
struct node{
long long x,s,e;
};
stack<node> st;
node p;
while(ps!=pe){
y=x;
while(1){
f(ps+1,ps+(1LL<<y),&s,&e);
if(s!=-1) break;
y++;
}
if(x!=y) while(!st.empty()) st.pop();
p.x=ps;p.s=s;p.e=e;
st.push(p);
x=y;
ps=e;
}
if(x==0) return 1;
while(!st.empty()){
p=st.top();st.pop();
maxx=max(maxx,p.s-p.x);
}
return maxx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
552 KB |
Output is correct |
4 |
Correct |
1 ms |
632 KB |
Output is correct |
5 |
Correct |
1 ms |
632 KB |
Output is correct |
6 |
Correct |
2 ms |
632 KB |
Output is correct |
7 |
Correct |
2 ms |
632 KB |
Output is correct |
8 |
Correct |
2 ms |
680 KB |
Output is correct |
9 |
Correct |
2 ms |
680 KB |
Output is correct |
10 |
Correct |
1 ms |
680 KB |
Output is correct |
11 |
Correct |
2 ms |
680 KB |
Output is correct |
12 |
Correct |
2 ms |
680 KB |
Output is correct |
13 |
Correct |
2 ms |
680 KB |
Output is correct |
14 |
Correct |
2 ms |
680 KB |
Output is correct |
15 |
Correct |
2 ms |
680 KB |
Output is correct |
16 |
Correct |
15 ms |
860 KB |
Output is correct |
17 |
Correct |
16 ms |
860 KB |
Output is correct |
18 |
Correct |
14 ms |
860 KB |
Output is correct |
19 |
Correct |
15 ms |
860 KB |
Output is correct |
20 |
Correct |
11 ms |
860 KB |
Output is correct |
21 |
Correct |
57 ms |
1388 KB |
Output is correct |
22 |
Correct |
74 ms |
1516 KB |
Output is correct |
23 |
Correct |
58 ms |
1516 KB |
Output is correct |
24 |
Correct |
64 ms |
1516 KB |
Output is correct |
25 |
Correct |
45 ms |
1516 KB |
Output is correct |
26 |
Correct |
56 ms |
1520 KB |
Output is correct |
27 |
Correct |
55 ms |
1520 KB |
Output is correct |
28 |
Correct |
53 ms |
1520 KB |
Output is correct |
29 |
Correct |
65 ms |
1520 KB |
Output is correct |
30 |
Correct |
39 ms |
1520 KB |
Output is correct |
31 |
Correct |
1 ms |
1520 KB |
Output is correct |
32 |
Correct |
1 ms |
1520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
1520 KB |
Partially correct |
2 |
Partially correct |
1 ms |
1520 KB |
Partially correct |
3 |
Partially correct |
1 ms |
1520 KB |
Partially correct |
4 |
Partially correct |
1 ms |
1520 KB |
Partially correct |
5 |
Partially correct |
2 ms |
1520 KB |
Partially correct |
6 |
Correct |
2 ms |
1520 KB |
Output is correct |
7 |
Incorrect |
1 ms |
1520 KB |
Output isn't correct |
8 |
Correct |
1 ms |
1520 KB |
Output is correct |
9 |
Correct |
1 ms |
1520 KB |
Output is correct |
10 |
Correct |
1 ms |
1520 KB |
Output is correct |
11 |
Correct |
2 ms |
1520 KB |
Output is correct |
12 |
Correct |
2 ms |
1520 KB |
Output is correct |
13 |
Correct |
2 ms |
1520 KB |
Output is correct |
14 |
Incorrect |
2 ms |
1520 KB |
Output isn't correct |
15 |
Partially correct |
2 ms |
1520 KB |
Partially correct |
16 |
Incorrect |
10 ms |
1520 KB |
Output isn't correct |
17 |
Correct |
10 ms |
1520 KB |
Output is correct |
18 |
Correct |
10 ms |
1520 KB |
Output is correct |
19 |
Correct |
9 ms |
1520 KB |
Output is correct |
20 |
Correct |
11 ms |
1520 KB |
Output is correct |
21 |
Correct |
34 ms |
1560 KB |
Output is correct |
22 |
Correct |
42 ms |
1560 KB |
Output is correct |
23 |
Correct |
35 ms |
1560 KB |
Output is correct |
24 |
Correct |
33 ms |
1560 KB |
Output is correct |
25 |
Partially correct |
73 ms |
3820 KB |
Partially correct |
26 |
Correct |
36 ms |
3820 KB |
Output is correct |
27 |
Correct |
34 ms |
3820 KB |
Output is correct |
28 |
Correct |
34 ms |
3820 KB |
Output is correct |
29 |
Correct |
34 ms |
3820 KB |
Output is correct |
30 |
Correct |
31 ms |
3820 KB |
Output is correct |
31 |
Partially correct |
1 ms |
3820 KB |
Partially correct |
32 |
Correct |
1 ms |
3820 KB |
Output is correct |