제출 #306125

#제출 시각아이디문제언어결과실행 시간메모리
306125lolicon비스킷 담기 (IOI20_biscuits)C++14
0 / 100
1085 ms189048 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 = 60; a.resize(k); int ret = 0; vector<int> tmp, S(k); for(int i = 0; i < k; i++) { tmp = a; for(int j = 1; j <= i; j++) { if(j == k - 1) break; tmp[j] += tmp[j - 1] / 2LL; tmp[j - 1] = (tmp[j - 1] & 1LL); } for(int j = i; j < k - 1; j++) { if(tmp[j] > x) { int cnt = tmp[j] - x; tmp[j + 1] += cnt / 2LL; tmp[j] = x + (cnt & 1LL); } } S[i] = 0; for(int j = 0; j < k; j++) { if(tmp[j] >= x) { S[i] |= 1LL << j; } } //printf("%lld%c", S[i], " \n"[i == k - 1]); } set<int> st; for(int i = 0; i < k; i++) { int x = S[i]; while(x) { //printf("add %lld\n", x); st.insert(x); x = (x - 1) & S[i]; } } ret = st.size() + 1; 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...