제출 #1013389

#제출 시각아이디문제언어결과실행 시간메모리
1013389ifateen비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1071 ms604 KiB
#include "biscuits.h" #include <iostream> const int MAX = 1e5; long long count_tastiness(long long x, std::vector<long long> a) { if (x > MAX) return 1; int n = std::min(19, (int)a.size()); long long ans = 1, sm = 0; for (int i = 0; i < n; ++i) sm += a[i] * (1 << i); auto works = [&](int count) -> bool { std::vector<long long> cur = a; for (int i = n - 1; i >= 0; --i) { if (count & (1 << i)) { long long tmp = x; int j = i, need = 1; while (tmp) { if (cur[j] < need) { j--; if (j < 0) return false; need <<= 1; } else { --tmp; cur[j] -= need; } } } else continue; } return true; }; for (int count = 1; count * x <= sm; ++count) { ans += works(count); } 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...