Submission #1051697

#TimeUsernameProblemLanguageResultExecution timeMemory
1051697fuad27Packing Biscuits (IOI20_biscuits)C++17
0 / 100
0 ms348 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define int long long map<pair<int, long long>, long long> mp; long long X; vector<long long> A; int k; long long solve(int i, long long add) { if(i == k)return 1; long long ans=0; if(add+A[i] >= X) { ans += solve(i+1, (add+A[i]-X)/2); } ans += solve(i+1, (add+A[i])/2); return ans; } long long count_tastiness(long long x, std::vector<long long> a) { mp.clear(); X=x; A=a; k = a.size(); A.push_back(0); long long ans=1; for(int i = 0;i<k;i++) { if(A[i] > x) { long long c = A[i]-x; c/=2; A[i+1] += c; c*=2; A[i] -= c; } // if(A[i] >= x)ans*=2; } return solve(0, 0); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:24:12: warning: unused variable 'ans' [-Wunused-variable]
   24 |  long long ans=1;
      |            ^~~
#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...