# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
106967 |
2019-04-21T10:45:41 Z |
golub |
Gap (APIO16_gap) |
C++14 |
|
38 ms |
1528 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);
int dx = (r - l) / (N - 1);
int 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 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
2 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 |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
284 KB |
Output isn't correct |
9 |
Incorrect |
2 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 |
2 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 |
3 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
8 ms |
512 KB |
Output isn't correct |
17 |
Incorrect |
11 ms |
512 KB |
Output isn't correct |
18 |
Incorrect |
9 ms |
508 KB |
Output isn't correct |
19 |
Incorrect |
7 ms |
512 KB |
Output isn't correct |
20 |
Incorrect |
10 ms |
640 KB |
Output isn't correct |
21 |
Incorrect |
25 ms |
1152 KB |
Output isn't correct |
22 |
Incorrect |
25 ms |
1152 KB |
Output isn't correct |
23 |
Incorrect |
27 ms |
1144 KB |
Output isn't correct |
24 |
Incorrect |
26 ms |
1176 KB |
Output isn't correct |
25 |
Incorrect |
19 ms |
1152 KB |
Output isn't correct |
26 |
Incorrect |
31 ms |
1144 KB |
Output isn't correct |
27 |
Incorrect |
26 ms |
1152 KB |
Output isn't correct |
28 |
Incorrect |
25 ms |
1144 KB |
Output isn't correct |
29 |
Incorrect |
25 ms |
1144 KB |
Output isn't correct |
30 |
Incorrect |
36 ms |
1528 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
384 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 |
384 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
5 |
Partially correct |
2 ms |
384 KB |
Partially 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 |
2 ms |
384 KB |
Output isn't correct |
10 |
Partially correct |
3 ms |
384 KB |
Partially correct |
11 |
Incorrect |
2 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 |
11 ms |
512 KB |
Output isn't correct |
17 |
Incorrect |
13 ms |
512 KB |
Output isn't correct |
18 |
Incorrect |
10 ms |
512 KB |
Output isn't correct |
19 |
Incorrect |
9 ms |
512 KB |
Output isn't correct |
20 |
Partially correct |
10 ms |
640 KB |
Partially correct |
21 |
Incorrect |
30 ms |
1144 KB |
Output isn't correct |
22 |
Incorrect |
31 ms |
1152 KB |
Output isn't correct |
23 |
Incorrect |
30 ms |
1144 KB |
Output isn't correct |
24 |
Incorrect |
27 ms |
1144 KB |
Output isn't correct |
25 |
Incorrect |
21 ms |
1152 KB |
Output isn't correct |
26 |
Incorrect |
26 ms |
1144 KB |
Output isn't correct |
27 |
Incorrect |
28 ms |
1144 KB |
Output isn't correct |
28 |
Incorrect |
26 ms |
1152 KB |
Output isn't correct |
29 |
Incorrect |
29 ms |
1128 KB |
Output isn't correct |
30 |
Partially correct |
38 ms |
1528 KB |
Partially correct |
31 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |