제출 #723328

#제출 시각아이디문제언어결과실행 시간메모리
723328MardukA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int N, int K, long long A, int S){ vector<int> sol; int lo = 0, hi = N; while(hi-lo>1){ int mid = (lo+hi)/2; if(skim(mid) >= A) hi = mid; else lo = mid; } int x = hi; int vx = skim(x); long long ans = 0; vector<int> f,l; f.clear(); l.clear(); for(int i = 1;i<K;i++){ long long q = skim(i); ans+=q; f.push_back(q); } if(x < K) impossible(); if(ans+vx >= A && ans+vx <= 2*A){ for(int i = 1;i<K;i++) sol.push_back(i); sol.push_back(x); answer(sol); return; } if(x <= K) impossible(); f.push_back(skim(K)); for(int i = x-K;i<x;i++) l.push_back(skim(i)); ans+=f[K-1]; if(ans >= A && ans <= 2*A){ for(int i = 1;i<=K;i++) sol.push_back(i); answer(sol); return; } for(int i = 0;i<K;i++){ if(f[i] == l[i]) impossible(); ans-=f[i]; ans+=l[i]; if(ans >= A && ans <= 2*A){ for(int j = 1+i+1;j<=K;j++) sol.push_back(j); for(int j = x-1;j>=x-1-i;j--) sol.push_back(j); answer(sol); return; } } impossible(); }
#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...