제출 #549837

#제출 시각아이디문제언어결과실행 시간메모리
549837PherokungA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms280 KiB
#include <bits/stdc++.h> #include "books.h" #define ll long long using namespace std; void solve(int n, int k, long long a, int s) { ll val = skim(k-1); ll mi = val,mx = val; for(int i=1;i<k-1;i++) mi += i, mx += (val-i); if(a < mi){ impossible(); return; } ll be = k,ed = n, last = -1; vector<int> ANS; for(int i=1;i<=k-1;i++) ANS.push_back(i); while(be <= ed){ ll mid = (be+ed)/2; ll diff = skim(mid); if(diff + mi >= a && diff + mx <= 2*a){ last = mid; break; } else if(diff + mi < a){ be = mid + 1; } else if(diff + mx > 2*a){ ed = mid - 1; } } if(last == -1){ impossible(); return; } ANS.push_back(last); answer(ANS); }
#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...