이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
#define mnto(x, y) x = min(x, (__typeof__(x)) y)
#define mxto(x, y) x = max(x, (__typeof__(x)) y)
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb emplace_back
typedef vector<int> vi;
typedef vector<ii> vii;
#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 100005
ll x[MAXN];
int todo[MAXN];
void solve(int n, int k, ll a, int s) {
REP (i, 1, k + 1) {
x[i] = skim(i);
}
ll sum = 0;
REP (i, 1, k + 1) {
todo[i] = i;
sum += x[i];
}
int prev = n;
RREP (i, k, 1) {
ll lo = i, hi = prev, mid;
ll res = -1;
while (lo <= hi) {
mid = hi + lo >> 1;
if (x[mid] == 0) x[mid] = skim(mid);
if (sum + x[mid] - x[i] <= 2 * a) {
lo = mid + 1;
res = mid;
} else {
hi = mid - 1;
}
}
sum = sum + x[res] - x[todo[i]];
todo[i] = res;
}
if (sum >= a && sum <= 2 * a) {
vi ans;
REP (i, 1, k + 1) {
ans.pb(todo[i]);
}
answer(ans);
return;
}
impossible();
return;
}
컴파일 시 표준 에러 (stderr) 메시지
books.cpp: In function 'void solve(int, int, ll, int)':
books.cpp:45:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
45 | mid = hi + lo >> 1;
| ~~~^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |