# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1088980 | Piokemon | A Difficult(y) Choice (BOI21_books) | C++17 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
// books.h books_sample.cpp sample_grader.cpp
// in a single folder and run:
// g++ books_sample.cpp sample_grader.cpp
// in this folder.
//
void solve(int N, int K, long long A, int S) {
int pocz,kon,srod;
pocz=1;
kon=N;
while(pocz<kon){
srod=(pocz+kon)/2;
if (skim(srod)>=A)kon=srod;
else pocz=srod+1;
}
if (pocz<=K-1)impossible();
long long int wart = skim(pocz);
vector<long long> val;
vector<int> ind;
for (int x=1;x<=min(K,pocz);x++)val.push_back(skim(x));
for (int x=max(K+1,pocz-K+1);x<=pocz;x++)val.push_back(skim(x));
for (int x=1;x<=min(K,pocz);x++)ind.push_back(x);
for (int x=max(K+1,pocz-K+1);x<=pocz;x++)ind.push_back(x);
long long suma=0;
for (int x=0;x<K-1;x++)suma+=val[x];
suma+=wart;
if (A<=suma && suma<=2*A){
vector<int> odp;
for (int x=0;x<K-1;x++)odp.push_back(ind[x]);
odp.push_back(pocz);
answer(odp);return;
}
suma=0;
for (int x=0;x<K;x++)suma+=val[x];
for (int x=K;x<val.size();x++){
if (A<=suma && suma<=2*A){
vector<int> odp;
for (int y=x-K;y<x;y++)odp.push_back(ind[y]);
answer(odp); return;
}
suma+=val[x];
suma-=val[x-K];
}
if (A<=suma && suma<=2*A){
vector<int> odp;
for (int y=val.size()-K;y<val.size();y++)odp.push_back(ind[y]);
answer(odp); return;
}
impossible();
}
컴파일 시 표준 에러 (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... |