제출 #696083

#제출 시각아이디문제언어결과실행 시간메모리
696083garam1732비스킷 담기 (IOI20_biscuits)C++14
21 / 100
99 ms1356 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; priority_queue<ll> pq; ll cnt[100]; long long count_tastiness(long long x, std::vector<long long> a) { if(x == 1) { for(int i = (int)a.size()-1; i > 0; i--) if(a[i-1]) a[i-1] += 2*a[i], a[i] = 0; ll res = 1; for(ll x : a) res *= (x+1); return res; } while(a.size() > 17) a.pop_back(); if(x > 100000) return 1; ll ans = 1; for(int v = 1; v <= 100000/x; v++) { while(pq.size()) pq.pop(); for(int i = 0; i < x; i++) pq.push(v); vector<ll> b = a; for(int i = (int)b.size()-1; i >= 0; i--) { while(b[i] && pq.size() && pq.top() >= (1<<i)) { ll y = pq.top(); pq.pop(); int z = min(b[i], y/(1<<i)); b[i] -= z, y -= z*(1<<i); if(y) pq.push(y); } } if(pq.empty()) 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...