제출 #1013394

#제출 시각아이디문제언어결과실행 시간메모리
1013394ifateen비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1059 ms436 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; long long n = a.size(); long long ans = 1, sm = 0; for (long long i = 0; i < n; ++i) sm += a[i] * (1ll << i); auto works = [&](long long count) -> bool { std::vector<long long> cur = a; for (long long i = n - 1; i >= 0; --i) { if (count & (1ll << i)) { long long tmp = x; long long 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 (long long 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...