(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #583185

#TimeUsernameProblemLanguageResultExecution timeMemory
583185joelauPacking Biscuits (IOI20_biscuits)C++14
100 / 100
73 ms1324 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long X; vector<long long> sum; map<long long,long long> memo; long long dp (long long x) { if (x < 0) return 0; if (x == 0) return 1; if (x == 1) return 1 + (sum[0] >= X); if (memo.find(x) != memo.end()) return memo[x]; long long n = 0; while ((1ll<<(n+1)) <= x) n++; return memo[x] = dp((1ll<<n)-1) + dp(min(x,sum[n]/X)-(1ll<<n)); } long long count_tastiness(long long x, vector<long long> a) { sum.clear(); memo.clear(); while (a.size() <= 60) a.push_back(0); sum.push_back(a[0]); for (long long i = 1; i < a.size(); ++i) sum.push_back(sum.back() + a[i] * (1ll<<i)); X = x; return dp(1ll<<60); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:23:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (long long i = 1; i < a.size(); ++i) sum.push_back(sum.back() + a[i] * (1ll<<i));
      |                        ~~^~~~~~~~~~
#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...