| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1334329 | enson | A Difficult(y) Choice (BOI21_books) | C++20 | 1 ms | 1092 KiB |
#include <bits/stdc++.h>
using namespace std;
#include "books.h"
void solve(int N, int K, long long A, int S){
int l = 1, r = N+1;
int m = (l+r)/2;
vector<long long>F(N+1, -1);
while (l < r){
m = (l+r)/2;
long long x = skim(m);
F[m] = x;
if (x >= A){
r = m;
} else {
l = m+1;
}
}
if (l < K) impossible();
long long ans = 0;
if (l != N){
for(int i = 1; i < K; i++){
F[i] = skim(i);
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);
answer(v);
}
}
if (l < K+1) impossible();
for(int i = 0; i <= K; i++){
vector<int>v;
ans = 0;
for(int j = 1; j < K-i+1; j++){
if (F[j] == -1)F[j] = skim(j);
ans += F[j];
v.push_back(j);
}
for(int j = l; j >= l-i+1; j--){
if (F[j] == -1)F[j] = skim(j);
ans += F[j];
v.push_back(j);
}
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... | ||||
