Submission #61234

# Submission time Handle Problem Language Result Execution time Memory
61234 2018-07-25T11:54:33 Z istlemin Gap (APIO16_gap) C++14
70 / 100
100 ms 3060 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;

        ll dn,up;
        ask(-1,2e18,&dn,&up);
        vi a;
		a.push_back(dn);
		a.push_back(up);
        ++dn;


        vi endPoints;
        endPoints.push_back(dn);

        ll numGroups = n/2+1;



        rep(i,0,numGroups){
            if(i<(up-dn)%numGroups)
				endPoints.push_back(endPoints[endPoints.size()-1]+(up-dn)/numGroups+1);
			else
				endPoints.push_back(endPoints[endPoints.size()-1]+(up-dn)/numGroups);
        }

        rep(i,0,numGroups){
            ll l = endPoints[i];
            ll r = endPoints[i+1];
            ll mn,mx;
            ask(l,r,&mn,&mx);
            if(mn==-1) continue;
            a.push_back(mn);
            a.push_back(mx);
        }

        sort(all(a));
        ll mxGap = 0;
        rep(i,0,a.size()-1) mxGap = max(mxGap,a[i+1]-a[i]);
        //cout<<"yes"<<endl;
        return mxGap;

	return 0;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:8: warning: unused variable 't' [-Wunused-variable]
     ll t = T;
        ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Incorrect 2 ms 356 KB Output isn't correct
3 Incorrect 4 ms 392 KB Output isn't correct
4 Incorrect 3 ms 468 KB Output isn't correct
5 Incorrect 3 ms 496 KB Output isn't correct
6 Incorrect 4 ms 548 KB Output isn't correct
7 Incorrect 3 ms 548 KB Output isn't correct
8 Incorrect 3 ms 548 KB Output isn't correct
9 Incorrect 2 ms 548 KB Output isn't correct
10 Incorrect 3 ms 548 KB Output isn't correct
11 Incorrect 4 ms 548 KB Output isn't correct
12 Incorrect 4 ms 592 KB Output isn't correct
13 Incorrect 3 ms 592 KB Output isn't correct
14 Incorrect 3 ms 616 KB Output isn't correct
15 Incorrect 3 ms 616 KB Output isn't correct
16 Incorrect 18 ms 1256 KB Output isn't correct
17 Incorrect 19 ms 1256 KB Output isn't correct
18 Incorrect 23 ms 1260 KB Output isn't correct
19 Incorrect 21 ms 1260 KB Output isn't correct
20 Incorrect 15 ms 1260 KB Output isn't correct
21 Incorrect 69 ms 2912 KB Output isn't correct
22 Incorrect 72 ms 2948 KB Output isn't correct
23 Incorrect 74 ms 2948 KB Output isn't correct
24 Incorrect 87 ms 2948 KB Output isn't correct
25 Incorrect 77 ms 2948 KB Output isn't correct
26 Incorrect 83 ms 2964 KB Output isn't correct
27 Incorrect 75 ms 2964 KB Output isn't correct
28 Incorrect 74 ms 2964 KB Output isn't correct
29 Incorrect 70 ms 3040 KB Output isn't correct
30 Incorrect 37 ms 3040 KB Output isn't correct
31 Incorrect 3 ms 3040 KB Output isn't correct
32 Incorrect 2 ms 3040 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3040 KB Output is correct
2 Correct 2 ms 3040 KB Output is correct
3 Correct 3 ms 3040 KB Output is correct
4 Correct 3 ms 3040 KB Output is correct
5 Correct 4 ms 3040 KB Output is correct
6 Correct 3 ms 3040 KB Output is correct
7 Correct 3 ms 3040 KB Output is correct
8 Correct 3 ms 3040 KB Output is correct
9 Correct 2 ms 3040 KB Output is correct
10 Correct 0 ms 3040 KB Output is correct
11 Correct 4 ms 3040 KB Output is correct
12 Correct 3 ms 3040 KB Output is correct
13 Correct 4 ms 3040 KB Output is correct
14 Correct 4 ms 3040 KB Output is correct
15 Correct 4 ms 3040 KB Output is correct
16 Correct 20 ms 3040 KB Output is correct
17 Correct 19 ms 3040 KB Output is correct
18 Correct 20 ms 3040 KB Output is correct
19 Correct 26 ms 3040 KB Output is correct
20 Correct 10 ms 3040 KB Output is correct
21 Correct 78 ms 3040 KB Output is correct
22 Correct 89 ms 3040 KB Output is correct
23 Correct 76 ms 3040 KB Output is correct
24 Correct 88 ms 3040 KB Output is correct
25 Correct 78 ms 3040 KB Output is correct
26 Correct 79 ms 3040 KB Output is correct
27 Correct 93 ms 3060 KB Output is correct
28 Correct 100 ms 3060 KB Output is correct
29 Correct 84 ms 3060 KB Output is correct
30 Correct 37 ms 3060 KB Output is correct
31 Correct 3 ms 3060 KB Output is correct
32 Correct 2 ms 3060 KB Output is correct