# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
735684 | Charizard2021 | A Difficult(y) Choice (BOI21_books) | C++17 | 1 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "books.h"
#include<bits/stdc++.h>
using namespace std;
vector<long long> seq;
bool IsInRange(long long A, long long Sum){
return Sum >= A && Sum <= (long long)2 * A;
}
void solve(int N, int K, long long A, int S){
long long low = (long long)0;
long long high = (long long)N;
high++;
while(low + 1 < high){
long long mid = (low + high)/(long long)2;
if(skim(mid) > A){
high = mid;
}
else{
low = mid;
}
}
long long GreaterVal = high;
if(GreaterVal < K){
impossible();
}
vector<long long> minimum;
long long SumMinimum = 0;
for(long long i = 1; i <= K; i++){
minimum.push_back(skim(i));
SumMinimum += minimum[i - 1];
}
if(GreaterVal <= N){
long long first_large_val = skim(GreaterVal);
if(IsInRange(A, SumMinimum + first_large_val)){
vector<int> ans(K, GreaterVal);
for(int i = 0; i < ans.size() - 1; i++){
ans[i] = i + 1;
}
answer(ans);
}
}
if(GreaterVal <= K){
impossible();
}
if(SumMinimum > (long long)2 * A){
impossible();
}
vector<long long> Inbetween;
long long SumInBetween = 0;
for(long long i = GreaterVal - K; i < GreaterVal; ++i){
Inbetween.push_back(skim(i));
SumInBetween += Inbetween[i - GreaterVal + K];
}
if(SumInBetween < A){
impossible();
}
vector<int> ans(K);
for(long long i = 0; i < ans.size(); i++){
ans[i] = i + 1;
}
for(long long i = K - 1; ; i--){
if(IsInRange(A, SumMinimum)){
answer(ans);
}
SumMinimum -= minimum[i];
SumMinimum += Inbetween[i];
ans[i] = GreaterVal - K + i;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |