Submission #772372

#TimeUsernameProblemLanguageResultExecution timeMemory
772372SanguineChameleonPacking Biscuits (IOI20_biscuits)C++17
100 / 100
61 ms1376 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long mx[60][60]; long long dp[60][60]; long long count_tastiness(long long x, vector<long long> a) { a.resize(60); long long sum = 0; for (int i = 0; i < 60; i++) { sum += a[i] << i; mx[i][i] = min((1LL << (i + 1)) - 1, sum / x); } for (int i = 0; i < 60; i++) { for (int j = i + 1; j < 60; j++) { mx[i][j] = (1LL << (j + 1)) - 1; for (int k = j; k >= i; k--) { mx[i][j] = min(mx[i][j], mx[k][k]); if (k > i) { mx[i][j] &= (1LL << k) - 1; } } } } for (int i = 0; i < 60; i++) { for (int j = i; j < 60; j++) { dp[i][j] = (i ? dp[i - 1][j] : 1); if (mx[i][j] & (1LL << i)) { dp[i][j] += (i ? dp[i - 1][i - 1] : 1); } } } return dp[59][59]; }
#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...