제출 #831615

#제출 시각아이디문제언어결과실행 시간메모리
831615Dremix10비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1069 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define all(x) (x).begin(),(x).end() const int N = 3e5+5; const int MOD = 1e9+7; const ll INF = 1e18+5; #ifdef dremix #define p2(x,y) cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl; #define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<endl; #else #define p2(x,y) {} #define ppv(x) {} #define pv(x) {} #endif long long count_tastiness(long long x, std::vector<long long> a) { int n = a.size(); ll sum = 0; int i; for(i=0;i<n;i++){ sum += (1<<i) * a[i]; } ll ub = sum/x; ll ret = 1; for(i=1;i<=ub;i++){ vector<ll> curr = a; bool ok = 1; for(int j=n-1;j>=0;j--){ if(((1<<j)&i)==false){ continue; } int k = j; ll need = x; while(need > 0 && k >= 0){ ll temp = min(need,curr[k]); need -= temp; curr[k] -= temp; need *= 2; k--; } if(need > 0){ ok = 0; } } p2(i,ok) ret += ok; } 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...