제출 #1220832

#제출 시각아이디문제언어결과실행 시간메모리
1220832brinton비스킷 담기 (IOI20_biscuits)C++20
9 / 100
39 ms328 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, vector<long long> a) { int sumA = 0; for(int i = 0;i < a.size();i++) sumA += a[i]*(1LL<<i); a.resize(61); long long tot = 1; for(int y = 1;y <= 100000;y++){ if(y*x > sumA) break; vector<long long> need; int cur = y; while(cur) { need.push_back((cur%2)*x); cur /= 2; } // cout << need.size() << endl; // for(auto &i:need) cout << i << " ";cout << endl; for(int i = need.size()-1;i >= 0;i--){ need[i] = max(0LL,need[i]-a[i]); if(i > 0) need[i-1] += 2*need[i]; } // for(auto &i:need) cout << i << " ";cout << endl; if(need[0] == 0) { // cout << "!" << y << endl; tot++; } } return tot; }
#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...