| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1334350 | enson | A Difficult(y) Choice (BOI21_books) | C++20 | 1 ms | 1180 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;
F[m] = skim(m+1);
if (F[m] >= A){
r = m;
} else {
l = m+1;
}
}
if (l < K-1) impossible();
long long ans = 0;
if (l != N){
F[l] = skim(l+1);
for(int i = 1; i < K; i++){
if (F[i-1] == -1) F[i-1] = skim(i);
ans += F[i-1];
}
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... | ||||
