# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
35669 |
2017-11-28T03:43:03 Z |
funcsr |
Gap (APIO16_gap) |
C++14 |
|
0 ms |
0 KB |
#include "gap.h"
#include <iostream>
#include <vector>
#include <deque>
#include <cassert>
#include <algorithm>
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(xs) xs.begin(), xs.end()
#define pb push_back
using namespace std;
typedef pair<long long, long long> P;
P query(long long s, long long t) {
long long mn, mx;
MinMax(s, t, &mn, &mx);
return P(mn, mx);
}
long long findGap(int T, int N) {
if (T == 1) {
long long lo = 0, hi = 1000000000000000000LL;
vector<long long> fr, br;
rep(_, (N+1)/2) {
long long a, b;
tie(a, b) = query(lo, hi);
lo = a+1, hi = b-1;
fr.pb(a);
if (a != b) br.pb(b);
}
reverse(all(br));
for (long long x : br) fr.pb(x);
//for (long long x: fr)cout<<x<<",";cout<<"\n";
assert(fr.size() == N);
long long m = 0;
rep(i, N-1) m = max(m, fr[i+1]-fr[i]);
return m;
}
else {
return 0;
}
return 0;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:25:15: error: 'tie' was not declared in this scope
tie(a, b) = query(lo, hi);
^
In file included from /usr/include/c++/5/cassert:43:0,
from gap.cpp:5:
gap.cpp:33:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(fr.size() == N);
^