제출 #1247587

#제출 시각아이디문제언어결과실행 시간메모리
1247587nikulidPacking Biscuits (IOI20_biscuits)C++20
0 / 100
1093 ms412 KiB
#include <iostream> #include "biscuits.h" #include <vector> using namespace std; bool debug=0; #define dout if(debug)cout #define ll long long ll count_tastiness(ll x, vector<ll> a) { int k=a.size(); // subtask 1 ll answer=0; bool works; vector<ll> b(30), r(30); for(ll i=1; i<100001; i++){ // check if y=i is possible for(ll j=0; j<30; j++){ if(j<k) b[j] = a[j]; else b[j]=0; r[j] = ((i%(1<<(j+1)))/(1<<(j)))*x; b[j] -= r[j]; } if(debug && i%1873==0) { dout<<"for i="<<i<<", we have r as follows:\n"; for(auto e:r)dout<<e<<" "; dout<<"\nand b as follows:\n"; for(auto e:b)dout<<e<<" "; dout<<"\n"; } works=true; for(int j=0; j<30; j++){ if(b[j]<0){ works=false; break; } if(j<29)b[j+1] += b[j]/2; b[j] %= 2; } if(works){ answer++; dout<<"$ "<<i<<" is possible!\n"; } } dout<<"final answer: "<<answer<<"\n"; return answer; }
#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...