Submission #1055541

#TimeUsernameProblemLanguageResultExecution timeMemory
1055541TrentPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms348 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; #define forR(i, x) for(int i = 0; i < (x); ++i) #define REP(i, a, b) for(int i = (a); i < (b); ++i) #define all(x) x.begin(), x.end() typedef long long ll; typedef vector<ll> vll; ll valOf(ll msk, vll& dc) { ll ret = 0; forR(i, dc.size()) if(msk & (1 << i)) ret += dc[dc.size() - 1 - i]; return ret; } long long count_tastiness(long long x, std::vector<long long> a) { int k = a.size(); vll vals = {a[0]}; forR(i, k) { if(i + 1 < k) { vll nex; for(ll j : vals) { nex.push_back(j / 2 + a[i+1]); if(x <= j) nex.push_back((j-x) / 2 + a[i+1]); } vals.swap(nex); } else { ll tot = 0; for(ll j : vals) tot += j >= x ? 2 : 1; return tot; } } }

Compilation message (stderr)

biscuits.cpp: In function 'll valOf(ll, vll&)':
biscuits.cpp:4:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define forR(i, x) for(int i = 0; i < (x); ++i)
      |                                     ^
biscuits.cpp:12:2: note: in expansion of macro 'forR'
   12 |  forR(i, dc.size()) if(msk & (1 << i)) ret += dc[dc.size() - 1 - i];
      |  ^~~~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:17:18: warning: control reaches end of non-void function [-Wreturn-type]
   17 |  vll vals = {a[0]};
      |                  ^
#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...