(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 #1082809

#TimeUsernameProblemLanguageResultExecution timeMemory
1082809beaconmcPacking Biscuits (IOI20_biscuits)C++14
12 / 100
1075 ms65860 KiB
#include "biscuits.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; vector<ll> A(200); ll X; map<vector<ll>, ll> dps; ll dp(ll pos, ll add){ if (dps.count({pos, add})) return dps[{pos, add}]; if (pos>200) return 1; ll temp = 0; if (add==0){ ll cur = 0; while (cur <= X && cur <= A[pos]){ temp += dp(pos+1, (A[pos]-cur)/2); cur += X; } }else{ ll idk = (A[pos] + add); ll cur = 0; while (cur <= X && cur <= idk){ temp += dp(pos+1, (idk-cur)/2); cur += X; } } dps[{pos, add}] = temp; return temp; } long long count_tastiness(long long x, std::vector<long long> a) { X = x; FOR(i,0,200) A[i] = 0; dps.clear(); FOR(i,0,a.size()) A[i] = a[i]; FOR(i,0,199){ bool flag = false; if (A[i]>=X) A[i]-=X, flag = true; A[i+1] += A[i]/2; A[i] = A[i]%2; if (flag) A[i] += X; } // FOR(i,0,10) cout << A[i] << " "; // cout << endl; // cout << dp(0,0) << endl; return dp(0,0); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:5:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
......
   46 |  FOR(i,0,a.size()) A[i] = a[i];
      |      ~~~~~~~~~~~~                
biscuits.cpp:46:2: note: in expansion of macro 'FOR'
   46 |  FOR(i,0,a.size()) A[i] = a[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...