이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
using namespace std;
typedef long long ll;
const ll MAX = 1LL << 60;
using pii = pair<int, int>;
void ans(int st, int k){
vector<int> v(k);
for(int i = 0; i < k; i++) v[i] = st + i;
answer(v);
}
vector<ll> x;
ll query(int i){
if(x[i] == -1) x[i] = skim(i);
return x[i];
}
ll qrange(int l, int r){
ll sum = 0;
for(int i = l; i <= r; i++) sum += query(i);
return sum;
}
void solve(int n, int k, ll A, int S){
x.resize(n + 1, -1);
int l = 1, r = n - k + 1;
while(l < r){
int m = (l + r) / 2;
if(qrange(m, m + k - 1) < A) l = m + 1;
else r = m;
}
ll sum = qrange(l, l + k - 1);
if(sum > 2 * A || sum < A) impossible();
ans(l, k);
}
# | 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... |