제출 #615938

#제출 시각아이디문제언어결과실행 시간메모리
615938fvogel499비스킷 담기 (IOI20_biscuits)C++17
0 / 100
8 ms428 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define vi vector<int> #define int long long #define pb push_back #define ins insert #define sz(x) (int)((x).size()) long long count_tastiness(long long x, std::vector<long long> b) { while (sz(b) < 60) b.push_back(0); int lim [60+1]; int sum = 0; for (int i = 0; i < 60; i++) { sum += (1LL<<i)*b[i]; lim[i] = min(sum, (1LL<<(i+1))-1); } lim[60] = (1LL<<60)-1; int dp [60][60+1]; for (int i = 0; i <= 60; i++) { if (lim[0] == 0 || (lim[i]&1) == 0) { dp[0][i] = 1; } else { dp[0][i] = 2; } } for (int i = 1; i < 60; i++) for (int j = 0; j <= 60; j++) { int resultingMask = (1LL<<(i-1))-1; int newJ = j; if ((lim[i]&resultingMask) < (lim[j]&resultingMask)) { newJ = i; } dp[i][j] = 0; if (((lim[i]>>i)&1) && ((lim[j]>>i)&1)) { dp[i][j] += dp[i-1][newJ]; // add one dp[i][j] += dp[i-1][60]; // add zero } else { dp[i][j] += dp[i-1][newJ]; // add zero } } int res = dp[60-1][60]; return res; }
#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...