제출 #656827

#제출 시각아이디문제언어결과실행 시간메모리
656827ktkeremA Difficult(y) Choice (BOI21_books)C++17
0 / 100
1 ms312 KiB
#include<bits/stdc++.h> #include "books.h" typedef long long ll; typedef std::pair<ll , ll> llll; typedef std::string str; #define debug std::cout << "debug" << std::endl #define pb push_back ll kp[150000]; ll fun(ll x){ if(kp[x] == 0){ kp[x] = skim(x); } return kp[x]; } void solve(int n , int m ,ll a , int s){ ll tot = 0; for(ll i = 1;m>i;i++){ tot+=fun(i); } ll l = m , r = n+1; while(r - l > 1){ ll md = (l+r)/2; ll z = fun(md); if(z + tot > 2 *a){ r = md; } else{ l = md; } } if(tot + fun(l) > 2*a){ impossible(); return; } if(tot + fun(l) >= a && 2*a >= tot + fun(l)){ std::vector<int> v; for(ll i = 1;m>i;i++){ v.pb(i); } v.pb(l); answer(v); return; } tot = 0; for(ll i = 0;m>=i;i++){ for(ll j =1;i>=j;j++){ tot+=fun(j); } for(ll j = l - (m - i);l>j;j++){ tot+=fun(j); } if(tot >= a && 2*a >= tot){ std::vector<int> v; for(ll j =1;i>=j;j++){ v.pb(j); } for(ll j = l - (m - i);l>j;j++){ v.pb(j); } answer(v); return; } tot = 0; } impossible(); } /*int main(){ #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif ll t = 1;std::cin >> t; while(t--){ solve(); } return 0; }*/
#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...