Submission #306124

#TimeUsernameProblemLanguageResultExecution timeMemory
306124loliconPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1105 ms199516 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 = 0; j < i; j++) { if(j == k - 1) break; tmp[j + 1] += tmp[j] / 2LL; tmp[j] = 0; } for(int j = i; j < k - 1; j++) { if(tmp[j] > x) { int cnt = tmp[j] - x; tmp[j + 1] += cnt / 2; tmp[j] = x; } } 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...