| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1334342 | enson | A Difficult(y) Choice (BOI21_books) | C++20 | 1 ms | 1196 KiB |
#include <bits/stdc++.h>
using namespace std;
#include "books.h"
void solve(int N, int K, long long A, int S){
int l = 0, r = N;
int m = (l+r)/2;
vector<long long>F(N, -1);
while (l < r){
m = (l+r)/2;
long long x = skim(m+1);
F[m] = x;
if (x >= A){
r = m;
} else {
l = m+1;
}
}
F[l] = skim(l+1);
if (l < K-1) impossible();
long long ans = 0;
if (l != N){
for(int i = 0; i < K-1; i++){
if (F[i] == -1) F[i] = skim(i+1);
ans += F[i];
}
ans += F[l];
if (ans <= 2*A){
vector<int>v;
for(int i = 1; i < K; i++)v.push_back(i);
v.push_back(l+1);
answer(v);
}
}
if (l < K) impossible();
for(int i = 0; i <= K; i++){
vector<int>v;
ans = 0;
for(int j = 0; j < K-i; j++){
if (F[j] == -1)F[j] = skim(j+1);
ans += F[j];
v.push_back(j+1);
}
for(int j = l-1; j >= l-i; j--){
if (F[j] == -1)F[j] = skim(j+1);
ans += F[j];
v.push_back(j+1);
}
if (ans >= A && ans <= 2*A) answer(v);
}
impossible();
}
| # | 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... | ||||
