Submission #48341

# Submission time Handle Problem Language Result Execution time Memory
48341 2018-05-11T18:03:40 Z vanogam Gap (APIO16_gap) C++14
30 / 100
68 ms 1516 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
long long MX=1000000000000000000;
long long findGap(int T, int N)
{
    long long mn,mx,pas=1,mn1,mx1,xr=2;
    MinMax(0,MX,&mn,&mx);
    xr=(mx-mn)/(N-1)-2;
    if(xr<=0) xr=2;
    //xr=xr/2*2;
    if(T==1){
        for(int i=1;i<(N+1)/2;i++){
            MinMax(mn+1,mx-1,&mn1,&mx1);
            if(mn1==-1) break;
            pas=max(pas,max(mn1-mn,mx-mx1));
            mx=mx1;
            mn=mn1;
        }
        return max(pas,mx-mn);
    }
    while(1){
        if(mn>=mx) break;
        if(MX-xr-1<mx)MinMax(mn+1,MX,&mn1,&mx1); else
        MinMax(mn+1,mn+1+xr,&mn1,&mx1);

        if(mn1==-1) {xr*=2;continue;}
        pas=max(pas,mn1-mn);
        mn=mx1;

    }

	return pas;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 476 KB Output is correct
3 Correct 2 ms 476 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 2 ms 592 KB Output is correct
6 Correct 2 ms 592 KB Output is correct
7 Correct 2 ms 644 KB Output is correct
8 Correct 2 ms 644 KB Output is correct
9 Correct 2 ms 644 KB Output is correct
10 Correct 2 ms 644 KB Output is correct
11 Correct 3 ms 644 KB Output is correct
12 Correct 2 ms 644 KB Output is correct
13 Correct 2 ms 644 KB Output is correct
14 Correct 2 ms 644 KB Output is correct
15 Correct 2 ms 644 KB Output is correct
16 Correct 15 ms 724 KB Output is correct
17 Correct 14 ms 868 KB Output is correct
18 Correct 15 ms 868 KB Output is correct
19 Correct 16 ms 868 KB Output is correct
20 Correct 11 ms 868 KB Output is correct
21 Correct 55 ms 1388 KB Output is correct
22 Correct 55 ms 1392 KB Output is correct
23 Correct 54 ms 1392 KB Output is correct
24 Correct 54 ms 1392 KB Output is correct
25 Correct 46 ms 1516 KB Output is correct
26 Correct 54 ms 1516 KB Output is correct
27 Correct 55 ms 1516 KB Output is correct
28 Correct 60 ms 1516 KB Output is correct
29 Correct 53 ms 1516 KB Output is correct
30 Correct 40 ms 1516 KB Output is correct
31 Correct 2 ms 1516 KB Output is correct
32 Correct 2 ms 1516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1516 KB Output is correct
2 Incorrect 2 ms 1516 KB Output isn't correct
3 Incorrect 2 ms 1516 KB Output isn't correct
4 Incorrect 2 ms 1516 KB Output isn't correct
5 Correct 2 ms 1516 KB Output is correct
6 Incorrect 2 ms 1516 KB Output isn't correct
7 Incorrect 2 ms 1516 KB Output isn't correct
8 Incorrect 2 ms 1516 KB Output isn't correct
9 Incorrect 2 ms 1516 KB Output isn't correct
10 Correct 2 ms 1516 KB Output is correct
11 Incorrect 2 ms 1516 KB Output isn't correct
12 Incorrect 2 ms 1516 KB Output isn't correct
13 Incorrect 2 ms 1516 KB Output isn't correct
14 Incorrect 3 ms 1516 KB Output isn't correct
15 Correct 4 ms 1516 KB Output is correct
16 Incorrect 9 ms 1516 KB Output isn't correct
17 Incorrect 9 ms 1516 KB Output isn't correct
18 Incorrect 9 ms 1516 KB Output isn't correct
19 Incorrect 8 ms 1516 KB Output isn't correct
20 Correct 6 ms 1516 KB Output is correct
21 Incorrect 29 ms 1516 KB Output isn't correct
22 Incorrect 28 ms 1516 KB Output isn't correct
23 Incorrect 30 ms 1516 KB Output isn't correct
24 Incorrect 29 ms 1516 KB Output isn't correct
25 Correct 68 ms 1516 KB Output is correct
26 Incorrect 29 ms 1516 KB Output isn't correct
27 Incorrect 29 ms 1516 KB Output isn't correct
28 Incorrect 31 ms 1516 KB Output isn't correct
29 Incorrect 30 ms 1516 KB Output isn't correct
30 Correct 22 ms 1516 KB Output is correct
31 Incorrect 2 ms 1516 KB Output isn't correct
32 Correct 2 ms 1516 KB Output is correct