# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
42855 |
2018-03-05T14:10:58 Z |
fefe |
Gap (APIO16_gap) |
C++14 |
|
70 ms |
1440 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++;
y=ps;
while(ps!=pe){
y=max(y,ps);
while(1){
f(y+1,y+x,&s,&e);
y+=x;
if(s!=-1) break;
}
maxx=max(maxx,s-ps);
x=max(x,maxx);
ps=e;
}
return maxx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
248 KB |
Output is correct |
2 |
Correct |
1 ms |
352 KB |
Output is correct |
3 |
Correct |
1 ms |
424 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
608 KB |
Output is correct |
13 |
Correct |
2 ms |
608 KB |
Output is correct |
14 |
Correct |
2 ms |
608 KB |
Output is correct |
15 |
Correct |
2 ms |
608 KB |
Output is correct |
16 |
Correct |
16 ms |
732 KB |
Output is correct |
17 |
Correct |
14 ms |
732 KB |
Output is correct |
18 |
Correct |
18 ms |
736 KB |
Output is correct |
19 |
Correct |
14 ms |
736 KB |
Output is correct |
20 |
Correct |
10 ms |
736 KB |
Output is correct |
21 |
Correct |
52 ms |
1248 KB |
Output is correct |
22 |
Correct |
55 ms |
1372 KB |
Output is correct |
23 |
Correct |
54 ms |
1372 KB |
Output is correct |
24 |
Correct |
59 ms |
1372 KB |
Output is correct |
25 |
Correct |
46 ms |
1372 KB |
Output is correct |
26 |
Correct |
70 ms |
1372 KB |
Output is correct |
27 |
Correct |
53 ms |
1440 KB |
Output is correct |
28 |
Correct |
52 ms |
1440 KB |
Output is correct |
29 |
Correct |
54 ms |
1440 KB |
Output is correct |
30 |
Correct |
53 ms |
1440 KB |
Output is correct |
31 |
Correct |
1 ms |
1440 KB |
Output is correct |
32 |
Correct |
1 ms |
1440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1440 KB |
Output is correct |
2 |
Correct |
1 ms |
1440 KB |
Output is correct |
3 |
Correct |
1 ms |
1440 KB |
Output is correct |
4 |
Correct |
2 ms |
1440 KB |
Output is correct |
5 |
Correct |
1 ms |
1440 KB |
Output is correct |
6 |
Correct |
1 ms |
1440 KB |
Output is correct |
7 |
Correct |
1 ms |
1440 KB |
Output is correct |
8 |
Correct |
1 ms |
1440 KB |
Output is correct |
9 |
Correct |
1 ms |
1440 KB |
Output is correct |
10 |
Correct |
1 ms |
1440 KB |
Output is correct |
11 |
Correct |
2 ms |
1440 KB |
Output is correct |
12 |
Correct |
2 ms |
1440 KB |
Output is correct |
13 |
Correct |
2 ms |
1440 KB |
Output is correct |
14 |
Correct |
2 ms |
1440 KB |
Output is correct |
15 |
Correct |
3 ms |
1440 KB |
Output is correct |
16 |
Correct |
10 ms |
1440 KB |
Output is correct |
17 |
Correct |
13 ms |
1440 KB |
Output is correct |
18 |
Correct |
14 ms |
1440 KB |
Output is correct |
19 |
Correct |
10 ms |
1440 KB |
Output is correct |
20 |
Correct |
7 ms |
1440 KB |
Output is correct |
21 |
Correct |
35 ms |
1440 KB |
Output is correct |
22 |
Correct |
36 ms |
1440 KB |
Output is correct |
23 |
Correct |
47 ms |
1440 KB |
Output is correct |
24 |
Correct |
57 ms |
1440 KB |
Output is correct |
25 |
Correct |
69 ms |
1440 KB |
Output is correct |
26 |
Correct |
44 ms |
1440 KB |
Output is correct |
27 |
Correct |
40 ms |
1440 KB |
Output is correct |
28 |
Correct |
39 ms |
1440 KB |
Output is correct |
29 |
Correct |
55 ms |
1440 KB |
Output is correct |
30 |
Correct |
33 ms |
1440 KB |
Output is correct |
31 |
Correct |
1 ms |
1440 KB |
Output is correct |
32 |
Correct |
1 ms |
1440 KB |
Output is correct |