Submission #61096

# Submission time Handle Problem Language Result Execution time Memory
61096 2018-07-25T08:04:39 Z istlemin Gap (APIO16_gap) C++14
0 / 100
87 ms 2688 KB
#include "gap.h"
#include<bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

void ask(ll l,ll r, ll *mn,ll *mx){
    ll ansMn,ansMx;
    MinMax(l,r-1,&ansMn,&ansMx);
    (*mn) = ansMn;
	(*mx) = ansMx;
}

long long findGap(int T, int N) {
    ll t = T;
    ll n = N;

    if(t==1){
        vi a;
        ll l = 1;
        ll r = 1e18+1;
        while(true){
            ll mn,mx;
            ask(l,r,&mn,&mx);
            if(mn==-1) break;
            l = mn+1;
            r = mx;
			a.push_back(mn);
			if(mn==mx) break;
			a.push_back(mx);
        }
        sort(all(a));
        ll mxGap = 0;
        rep(i,0,n-1) mxGap = max(mxGap,a[i+1]-a[i]);
        return mxGap;
    }

	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 432 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 3 ms 636 KB Output is correct
6 Incorrect 3 ms 636 KB Output isn't correct
7 Incorrect 3 ms 636 KB Output isn't correct
8 Incorrect 2 ms 636 KB Output isn't correct
9 Incorrect 3 ms 636 KB Output isn't correct
10 Runtime error 3 ms 636 KB Execution failed because the return code was nonzero
11 Incorrect 3 ms 636 KB Output isn't correct
12 Incorrect 3 ms 636 KB Output isn't correct
13 Incorrect 4 ms 636 KB Output isn't correct
14 Incorrect 3 ms 636 KB Output isn't correct
15 Incorrect 4 ms 636 KB Output isn't correct
16 Incorrect 20 ms 1156 KB Output isn't correct
17 Incorrect 18 ms 1252 KB Output isn't correct
18 Incorrect 24 ms 1252 KB Output isn't correct
19 Incorrect 22 ms 1252 KB Output isn't correct
20 Runtime error 16 ms 1252 KB Execution failed because the return code was nonzero
21 Incorrect 84 ms 2536 KB Output isn't correct
22 Incorrect 67 ms 2536 KB Output isn't correct
23 Incorrect 71 ms 2536 KB Output isn't correct
24 Incorrect 80 ms 2536 KB Output isn't correct
25 Incorrect 87 ms 2536 KB Output isn't correct
26 Incorrect 69 ms 2688 KB Output isn't correct
27 Incorrect 80 ms 2688 KB Output isn't correct
28 Incorrect 73 ms 2688 KB Output isn't correct
29 Incorrect 74 ms 2688 KB Output isn't correct
30 Runtime error 50 ms 2688 KB Execution failed because the return code was nonzero
31 Incorrect 2 ms 2688 KB Output isn't correct
32 Correct 2 ms 2688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2688 KB Output isn't correct
2 Incorrect 3 ms 2688 KB Output isn't correct
3 Incorrect 3 ms 2688 KB Output isn't correct
4 Incorrect 3 ms 2688 KB Output isn't correct
5 Incorrect 2 ms 2688 KB Output isn't correct
6 Incorrect 2 ms 2688 KB Output isn't correct
7 Incorrect 2 ms 2688 KB Output isn't correct
8 Incorrect 2 ms 2688 KB Output isn't correct
9 Incorrect 3 ms 2688 KB Output isn't correct
10 Incorrect 2 ms 2688 KB Output isn't correct
11 Incorrect 3 ms 2688 KB Output isn't correct
12 Incorrect 3 ms 2688 KB Output isn't correct
13 Incorrect 3 ms 2688 KB Output isn't correct
14 Incorrect 4 ms 2688 KB Output isn't correct
15 Incorrect 3 ms 2688 KB Output isn't correct
16 Incorrect 9 ms 2688 KB Output isn't correct
17 Incorrect 11 ms 2688 KB Output isn't correct
18 Incorrect 12 ms 2688 KB Output isn't correct
19 Incorrect 12 ms 2688 KB Output isn't correct
20 Incorrect 9 ms 2688 KB Output isn't correct
21 Incorrect 34 ms 2688 KB Output isn't correct
22 Incorrect 38 ms 2688 KB Output isn't correct
23 Incorrect 41 ms 2688 KB Output isn't correct
24 Incorrect 32 ms 2688 KB Output isn't correct
25 Incorrect 23 ms 2688 KB Output isn't correct
26 Incorrect 36 ms 2688 KB Output isn't correct
27 Incorrect 38 ms 2688 KB Output isn't correct
28 Incorrect 47 ms 2688 KB Output isn't correct
29 Incorrect 37 ms 2688 KB Output isn't correct
30 Incorrect 25 ms 2688 KB Output isn't correct
31 Incorrect 3 ms 2688 KB Output isn't correct
32 Incorrect 4 ms 2688 KB Output isn't correct