제출 #834065

#제출 시각아이디문제언어결과실행 시간메모리
834065Johann비스킷 담기 (IOI20_biscuits)C++14
0 / 100
28 ms596 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() const ll bound = 2 * 1e9; int X; ll ans = 0; vi A; bool check(ll num, int idx, ll force) { assert(force <= bound); if (num == 0) return true; if (num & (1LL << idx)) { if (force < X) return false; force -= X; num = num ^ (1LL << idx); } force /= 2; if (idx + 1 < sz(A)) force += A[idx + 1]; return check(num, idx + 1, force); } long long count_tastiness(long long _X, std::vector<long long> a) { X = _X; ans = 0; A = vi(all(a)); for (int i = 0; i <= 100000; ++i) if (check(i, 0, a[0])) ++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...