제출 #521396

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5213962022-02-02 04:06:19pavementA Difficult(y) Choice (BOI21_books)C++17
100 / 100
2 ms320 KiB
#include "books.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll pf[100005];
map<int, ll> mem;
ll qry(int x) {
if (mem.find(x) != mem.end()) return mem[x];
return mem[x] = skim(x);
}
void solve(int N, int K, ll A, int S) {
int lo = 1, hi = N, ans = -1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
if (qry(mid) >= A) ans = mid, hi = mid - 1;
else lo = mid + 1;
}
if (ans != -1 && ans < K) impossible();
if (ans != -1) {
ll cum = qry(ans);
vector<int> vec;
for (int i = 1; i < K; i++) cum += qry(i);
if (A <= cum && cum <= 2 * A) {
for (int i = 1; i < K; i++) vec.push_back(i);
vec.push_back(ans);
answer(vec);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...