제출 #303778

#제출 시각아이디문제언어결과실행 시간메모리
303778alex_velea비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <unordered_map> using namespace std; const int kMaxK = 127; typedef long long int64; #define DEBUG if(0) long long count_tastiness(int64 x, std::vector<int64> a) { a.resize(kMaxK, 0); for (int i = 0; i + 1 < kMaxK; i += 1) { if (a[i] > x) { int64 carry = (a[i] - x) / 2; a[i + 1] += carry; a[i] -= carry * 2; } } DEBUG { for (int i = 0; i < 10; i += 1) { cerr << a[i] << '\t'; } cerr << '\n'; } unordered_map<int64, int64> old = { {0, 1} }; int64 ans = 1; for (int i = 0; i < kMaxK; i += 1) { unordered_map<int64, int64> new_dp; for (auto& itr : old) { int64 carry = itr.first; int64 num = itr.second; if (carry + a[i] >= x) { DEBUG cerr << "Add + for " << i << '\n'; ans += num; new_dp[(carry + a[i] - x) / 2] += num; } new_dp[(carry + a[i]) / 2] += num; } old = new_dp; } return ans; }

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

biscuits.cpp:10:36: error: 'std::vector' has not been declared
   10 | long long count_tastiness(int64 x, std::vector<int64> a) {
      |                                    ^~~
biscuits.cpp:10:47: error: expected ',' or '...' before '<' token
   10 | long long count_tastiness(int64 x, std::vector<int64> a) {
      |                                               ^
biscuits.cpp: In function 'long long int count_tastiness(int64, int)':
biscuits.cpp:11:5: error: 'a' was not declared in this scope
   11 |     a.resize(kMaxK, 0);
      |     ^