Submission #307372

#TimeUsernameProblemLanguageResultExecution timeMemory
307372arthur_nascimentoPacking Biscuits (IOI20_biscuits)C++14
42 / 100
1091 ms35708 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define debug #define maxn 64 unordered_map<ll,ll> mp[64]; ll v[maxn]; int n; ll X; ll get(int pos,ll xt){ if(mp[pos].find(xt) != mp[pos].end()) return mp[pos][xt]; ll ans = 0; if(pos == n-1){ debug("%d %lld rets %lld\n",pos,xt,1+(xt + v[pos])/X); return 1+(xt + v[pos])/X; } ans = get(pos+1,(xt+v[pos])/2); if(v[pos]+xt >= X) ans += get(pos+1, (xt+v[pos]-X)/2); debug("%d %lld rets %lld\n",pos,xt,ans); return mp[pos][xt] = ans; } long long count_tastiness(long long x, std::vector<long long> a) { X = x; for(int i=0;i<64;i++) mp[i].clear(), v[i] = a[i]; n = a.size(); debug("n %d, x %lld : ",n,x); for(ll i : a) debug("%lld ",i); debug("\n"); return get(0,0); }

Compilation message (stderr)

biscuits.cpp: In function 'll get(int, ll)':
biscuits.cpp:18:9: warning: left operand of comma operator has no effect [-Wunused-value]
   18 |   debug("%d %lld rets %lld\n",pos,xt,1+(xt + v[pos])/X);
      |         ^~~~~~~~~~~~~~~~~~~~~
biscuits.cpp:18:35: warning: right operand of comma operator has no effect [-Wunused-value]
   18 |   debug("%d %lld rets %lld\n",pos,xt,1+(xt + v[pos])/X);
      |                                   ^~
biscuits.cpp:18:54: warning: right operand of comma operator has no effect [-Wunused-value]
   18 |   debug("%d %lld rets %lld\n",pos,xt,1+(xt + v[pos])/X);
      |                                                      ^
biscuits.cpp:24:8: warning: left operand of comma operator has no effect [-Wunused-value]
   24 |  debug("%d %lld rets %lld\n",pos,xt,ans);
      |        ^~~~~~~~~~~~~~~~~~~~~
biscuits.cpp:24:34: warning: right operand of comma operator has no effect [-Wunused-value]
   24 |  debug("%d %lld rets %lld\n",pos,xt,ans);
      |                                  ^~
biscuits.cpp:24:37: warning: right operand of comma operator has no effect [-Wunused-value]
   24 |  debug("%d %lld rets %lld\n",pos,xt,ans);
      |                                     ^~~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:35:8: warning: left operand of comma operator has no effect [-Wunused-value]
   35 |  debug("n %d, x %lld : ",n,x); for(ll i : a) debug("%lld ",i); debug("\n");
      |        ^~~~~~~~~~~~~~~~~
biscuits.cpp:35:28: warning: right operand of comma operator has no effect [-Wunused-value]
   35 |  debug("n %d, x %lld : ",n,x); for(ll i : a) debug("%lld ",i); debug("\n");
      |                            ^
biscuits.cpp:35:52: warning: left operand of comma operator has no effect [-Wunused-value]
   35 |  debug("n %d, x %lld : ",n,x); for(ll i : a) debug("%lld ",i); debug("\n");
      |                                                    ^~~~~~~
biscuits.cpp:35:70: warning: statement has no effect [-Wunused-value]
   35 |  debug("n %d, x %lld : ",n,x); for(ll i : a) debug("%lld ",i); debug("\n");
      |                                                                     ~^~~~~
#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...