이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <iostream>
#include <vector>
#include <deque>
#include <cassert>
#include <algorithm>
#include <tuple>
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
In file included from /usr/include/c++/5/cassert:43:0,
from gap.cpp:5:
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
assert(fr.size() == N);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |