Submission #1065760

#TimeUsernameProblemLanguageResultExecution timeMemory
1065760n1k비스킷 담기 (IOI20_biscuits)C++17
42 / 100
1038 ms91472 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; using ll = long long; const int K = 61; long long count_tastiness(long long x, std::vector<long long> a) { vector<ll> cnt(K+5); for(int i=0; i<a.size(); i++) cnt[i] = a[i]; ll ans = 0; cerr<<x<<endl; for(int i=0; i<K; i++){ ll take = max(0ll, (cnt[i]-x)/2); cnt[i+1] += take; cnt[i] -= 2*take; } for(auto e:cnt) cerr<<e<<" "; cerr<<endl; vector<map<ll, ll>> dp(K+5); dp[0][0] = 1; for(int i=0; i<K; i++){ for(auto [add, val]:dp[i]){ ll have = cnt[i] + add; // take if(have >= x){ dp[i+1][(have - x) / 2] += val; } dp[i+1][have/2] += val; } } for(auto [k, v]:dp[K]) { //cerr<<k<<" "<<v<<endl; ans+=v; } return ans; } /* 1 4 1 0 0 0 0 */

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:11:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i=0; i<a.size(); i++) cnt[i] = a[i];
      |               ~^~~~~~~~~
biscuits.cpp:19:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |  for(auto e:cnt) cerr<<e<<" "; cerr<<endl;
      |  ^~~
biscuits.cpp:19:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |  for(auto e:cnt) cerr<<e<<" "; cerr<<endl;
      |                                ^~~~
#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...