제출 #829108

#제출 시각아이디문제언어결과실행 시간메모리
829108definitelynotmee비스킷 담기 (IOI20_biscuits)C++17
42 / 100
1079 ms42276 KiB
#include "biscuits.h" //#include"grader.cpp" #include<bits/stdc++.h> #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<int,int>; const ll INFL = numeric_limits<ll>::max(); using pll = pair<ll,ll>; long long count_tastiness(long long x, std::vector<long long> a) { a.resize(60,0); int k = a.size(); vector<pll> dp; auto resp_for_carry =[&](ll carry){ return lower_bound(all(dp),pll({carry,0ll}))->ss; }; auto getdp =[&](ll vi, ll carry){ return resp_for_carry(2*(carry-vi)) + resp_for_carry(2*(carry+x-vi)); }; dp.push_back({0,1}); dp.push_back({INFL,0}); auto dc =[&](ll l, ll r, ll respl, ll respr, ll vi, vector<pll> & newdp, auto dc) -> void { if(l > r || respl == respr) return; ll m = (l+r)>>1; ll cur = getdp(vi,m); newdp.push_back({m,cur}); dc(l,m-1,respl,cur,vi,newdp,dc); dc(m+1,r,cur,respr,vi,newdp,dc); }; for(int i = 0; i < 60; i++){ vector<pll> newdp; newdp.push_back({0,getdp(a[i],0)}); newdp.push_back({INFL,0}); dc(1,4e18, newdp[0].ss, 0, a[i], newdp, dc); sort(all(newdp)); dp.swap(newdp); } return dp[0].ss; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:17:6: warning: unused variable 'k' [-Wunused-variable]
   17 |  int k = a.size();
      |      ^
#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...