# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
106950 |
2019-04-21T10:04:29 Z |
golub |
Gap (APIO16_gap) |
C++14 |
|
0 ms |
0 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<int, int>
#define int 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(int x) {
askcount++;
int mn = 0, mx = 0;
MinMax(x, x, &mn, &mx);
return {mn, mx};
}
long long findGap(int T, int N) {
int best_dist = 0;
int cur_value = 0;
while (true) {
if (askcount >= (N + 1) / 2) break;
pii res = ask(cur_value + best_dist + 1);
if (res.S == cur_value) cmax(best_dist, res.F - res.S);
cur_value = res.F;
if (res.F == -1) return best_dist;
}
return best_dist;
}
Compilation message
/tmp/ccnVu8lJ.o: In function `main':
grader.cpp:(.text.startup+0x18e): undefined reference to `findGap(int, int)'
collect2: error: ld returned 1 exit status