제출 #479248

#제출 시각아이디문제언어결과실행 시간메모리
479248khoabright비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1099 ms332 KiB
#include "biscuits.h" #include <vector> #include <cstdio> using namespace std; bool is_valid(long long y, long long x, vector<long long> &a) { long long carry = 0; for(int i=0; y>0; i++) { if(y & 1) { if(carry + a[i] < x) return false; carry = (carry + a[i] - x)/2; } else { carry = (carry + a[i])/2; } y = y/2; } return true; } long long count_tastiness(long long x, std::vector<long long> a) { long long s = 0; for(int i=0; i<(int)a.size(); i++) { s += (a[i]<<i); } while(a.size()<60) a.push_back(0); long long ans = 0; for(int i=0; i<=s; i++) { if(is_valid(i, x, a)) ans++; } return 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...