답안 #106969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
106969 2019-04-21T10:46:57 Z golub Gap (APIO16_gap) C++14
70 / 100
88 ms 3308 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 + 1;
		r += dx + 1;
	}
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 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 2 ms 384 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 3 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 4 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 4 ms 384 KB Output isn't correct
16 Incorrect 20 ms 896 KB Output isn't correct
17 Incorrect 18 ms 896 KB Output isn't correct
18 Incorrect 19 ms 896 KB Output isn't correct
19 Incorrect 20 ms 896 KB Output isn't correct
20 Incorrect 10 ms 512 KB Output isn't correct
21 Incorrect 84 ms 2252 KB Output isn't correct
22 Incorrect 74 ms 2288 KB Output isn't correct
23 Incorrect 74 ms 2288 KB Output isn't correct
24 Incorrect 73 ms 2288 KB Output isn't correct
25 Incorrect 81 ms 3308 KB Output isn't correct
26 Incorrect 74 ms 2300 KB Output isn't correct
27 Incorrect 88 ms 2288 KB Output isn't correct
28 Incorrect 81 ms 2388 KB Output isn't correct
29 Incorrect 79 ms 2500 KB Output isn't correct
30 Incorrect 39 ms 1572 KB Output isn't correct
31 Incorrect 2 ms 384 KB Output isn't correct
32 Incorrect 0 ms 384 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 18 ms 896 KB Output is correct
17 Correct 18 ms 896 KB Output is correct
18 Correct 18 ms 1016 KB Output is correct
19 Correct 26 ms 888 KB Output is correct
20 Correct 10 ms 640 KB Output is correct
21 Correct 73 ms 2288 KB Output is correct
22 Correct 84 ms 2288 KB Output is correct
23 Correct 74 ms 2288 KB Output is correct
24 Correct 75 ms 2292 KB Output is correct
25 Correct 66 ms 3304 KB Output is correct
26 Correct 71 ms 2332 KB Output is correct
27 Correct 75 ms 2292 KB Output is correct
28 Correct 82 ms 2292 KB Output is correct
29 Correct 68 ms 2268 KB Output is correct
30 Correct 35 ms 1532 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct