제출 #306056

#제출 시각아이디문제언어결과실행 시간메모리
306056lolicon비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1093 ms384 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; #define int long long #define SZ(x) ((int)(x).size()) #define all(x) begin(x), end(x) bool chk(int v, int x, vector<int> cnt) { for(int i = 0; i < x; i++) { int val = v; for(int j = SZ(cnt) - 1; j >= 0; j--) { int need = min(cnt[j], val / (1LL << j)); cnt[j] -= need; val -= (1ll << j) * need; } if(val) return false; } return true; } int count_tastiness(int x, vector<int> a) { int k = a.size(); int sum = 0; for(int i = 0; i < k; i++) { sum += (1LL << i) * a[i]; } int ret = 1; if(x == 1) { for(int i = k - 1; i > 0; i--) { if(a[i - 1] >= 2) { a[i - 1] += a[i] * 2; a[i] = 0; } } for(int i = 0; i < k; i++) { if(a[i]) ret *= (a[i] + 1); } } else { for(int i = 1; i * x <= sum; i++) { if(chk(i, x, a)) ret++; } } return ret; }
#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...