Submission #106968

# Submission time Handle Problem Language Result Execution time Memory
106968 2019-04-21T10:46:27 Z golub Gap (APIO16_gap) C++14
48.5412 / 100
95 ms 3320 KB
#include "gap.h"
#include<bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define pb push_back
#define pii pair<long long, long long>
#define len(x) (long long)x.size()

template<typename A, typename B>
bool cmax(A &a, const B &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename A, typename B>
bool cmin(A &a, const B &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int askcount = 0;

pii ask(long long s, long long t) {
	askcount++;
	long long mn = 0, mx = 0;
	MinMax(s, t, &mn, &mx);
	return {mn, mx};
}

long long findGap(int T, int N) {
	vector<long long> a;
	long long l = -1, r = (long long)1e18 + 1;
	MinMax(l, r, &l, &r);
	a.pb(l); a.pb(r);
	long long dx = (r - l) / (N - 1);
	long long MAX = r;
	r = l + dx;
	while (l < MAX) {
		pii res = ask(l, r);
		if (res.F != -1) a.pb(res.F);
		if (res.S != -1) a.pb(res.S);
		l += dx;
		r += dx;
	}
	long long best = -1;
	sort(all(a));
	// for (auto x: a) cout << x << "\n";
	for (int i = 0; i < len(a) - 1; i++) {
		cmax(best, a[i + 1] - a[i]);
	}
	return best;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 3 ms 384 KB Output isn't correct
5 Incorrect 3 ms 512 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 3 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 3 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 3 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 26 ms 1024 KB Output isn't correct
17 Incorrect 23 ms 896 KB Output isn't correct
18 Incorrect 18 ms 896 KB Output isn't correct
19 Incorrect 19 ms 896 KB Output isn't correct
20 Incorrect 11 ms 640 KB Output isn't correct
21 Incorrect 75 ms 2288 KB Output isn't correct
22 Incorrect 95 ms 2288 KB Output isn't correct
23 Incorrect 77 ms 2284 KB Output isn't correct
24 Incorrect 82 ms 2288 KB Output isn't correct
25 Incorrect 69 ms 3308 KB Output isn't correct
26 Incorrect 69 ms 2288 KB Output isn't correct
27 Incorrect 69 ms 2248 KB Output isn't correct
28 Incorrect 87 ms 2288 KB Output isn't correct
29 Incorrect 83 ms 2412 KB Output isn't correct
30 Incorrect 41 ms 1500 KB Output isn't correct
31 Incorrect 2 ms 304 KB Output isn't correct
32 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Partially correct 2 ms 384 KB Partially correct
3 Partially correct 2 ms 384 KB Partially correct
4 Partially correct 2 ms 384 KB Partially correct
5 Partially correct 3 ms 384 KB Partially correct
6 Partially correct 3 ms 384 KB Partially correct
7 Partially correct 0 ms 384 KB Partially correct
8 Partially correct 2 ms 384 KB Partially correct
9 Partially correct 2 ms 396 KB Partially correct
10 Partially correct 2 ms 384 KB Partially correct
11 Partially correct 3 ms 384 KB Partially correct
12 Partially correct 3 ms 384 KB Partially correct
13 Partially correct 3 ms 384 KB Partially correct
14 Partially correct 3 ms 384 KB Partially correct
15 Partially correct 3 ms 384 KB Partially correct
16 Partially correct 19 ms 896 KB Partially correct
17 Partially correct 18 ms 896 KB Partially correct
18 Partially correct 17 ms 896 KB Partially correct
19 Partially correct 21 ms 896 KB Partially correct
20 Partially correct 9 ms 640 KB Partially correct
21 Partially correct 72 ms 2288 KB Partially correct
22 Partially correct 78 ms 2288 KB Partially correct
23 Partially correct 73 ms 2288 KB Partially correct
24 Partially correct 68 ms 2288 KB Partially correct
25 Partially correct 70 ms 3320 KB Partially correct
26 Partially correct 69 ms 2288 KB Partially correct
27 Partially correct 74 ms 2408 KB Partially correct
28 Partially correct 75 ms 2416 KB Partially correct
29 Partially correct 79 ms 2284 KB Partially correct
30 Partially correct 36 ms 1528 KB Partially correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct