제출 #1052435

#제출 시각아이디문제언어결과실행 시간메모리
1052435fuad27비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; map<long long, long long> mp[62]; long long X; vector<long long> A; int k; long long solve(int i, long long add) { if(i == k)return 1; if(mp.find({i, add}) != mp.end())return mp[{i, add}]; mp[{i, add}] += solve(i+1, (add+A[i])/2); if(add+A[i] >= X) { mp[{i, add}] += solve(i+1, (add+A[i]-X)/2); } return mp[{i, add}]; } long long count_tastiness(long long x, std::vector<long long> a) { for(int i = 0;i<=61;i++)mp[i].clear(); X=x; A=a; k = 60; A.resize(61); for(int i = 0;i<k;i++) { if(A[i] > x) { long long c = A[i]-x; A[i+1] += c/2; c/=2; c*=2; A[i] -= c; } } return solve(0, 0); }

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

biscuits.cpp: In function 'long long int solve(int, long long int)':
biscuits.cpp:10:8: error: request for member 'find' in 'mp', which is of non-class type 'std::map<long long int, long long int> [62]'
   10 |  if(mp.find({i, add}) != mp.end())return mp[{i, add}];
      |        ^~~~
biscuits.cpp:10:29: error: request for member 'end' in 'mp', which is of non-class type 'std::map<long long int, long long int> [62]'
   10 |  if(mp.find({i, add}) != mp.end())return mp[{i, add}];
      |                             ^~~
biscuits.cpp:10:44: error: invalid types 'std::map<long long int, long long int> [62][<brace-enclosed initializer list>]' for array subscript
   10 |  if(mp.find({i, add}) != mp.end())return mp[{i, add}];
      |                                            ^
biscuits.cpp:11:4: error: invalid types 'std::map<long long int, long long int> [62][<brace-enclosed initializer list>]' for array subscript
   11 |  mp[{i, add}] += solve(i+1, (add+A[i])/2);
      |    ^
biscuits.cpp:13:5: error: invalid types 'std::map<long long int, long long int> [62][<brace-enclosed initializer list>]' for array subscript
   13 |   mp[{i, add}] += solve(i+1, (add+A[i]-X)/2);
      |     ^
biscuits.cpp:15:11: error: invalid types 'std::map<long long int, long long int> [62][<brace-enclosed initializer list>]' for array subscript
   15 |  return mp[{i, add}];
      |           ^