제출 #837097

#제출 시각아이디문제언어결과실행 시간메모리
837097azatega비스킷 담기 (IOI20_biscuits)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <map> #include <vector> using namespace std; #define ll long long map<pair<int, ll>, ll> memo; vector<ll> a; int n; ll x; ll compute(int k, ll amount){ if(memo[{k, amount}] > 0) return memo[{k, amount}]; if(k == a.size() - 1){ // last one ll res = 1; // can always be zero if(amount >= x) // can be 1 res++; memo[{k, amount}] = res; return res; } ll res = 0; if(amount >= x) res += compute(k+1, a[k+1] + (amount - x)/2); // can be 1 res += compute(k+1, a[k+1] + amount/2); // can be 0 memo[{k, amount}] = res; // cout << k << " - " << amount << ": " << memo[{k, amount}] << endl; return res; } long long count_tastiness(long long _x, vector<long long> _a){ memo.clear(); a = _a; x = _x; n = _a.size(); for(int i = 0; i < 100; i++) a.push_back(0); return compute(0, a[0]); } int main() { vector<ll> lol = {5,2,1}; cout << count_tastiness(3, lol) << endl; vector<ll> lol2 = {5,1,5}; cout << count_tastiness(2, lol2) << endl; cout << count_tastiness_two(2, lol2) << endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int compute(int, long long int)':
biscuits.cpp:18:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     if(k == a.size() - 1){
      |        ~~^~~~~~~~~~~~~~~
biscuits.cpp: In function 'int main()':
biscuits.cpp:56:13: error: 'count_tastiness_two' was not declared in this scope; did you mean 'count_tastiness'?
   56 |     cout << count_tastiness_two(2, lol2) << endl;
      |             ^~~~~~~~~~~~~~~~~~~
      |             count_tastiness