제출 #1022077

#제출 시각아이디문제언어결과실행 시간메모리
1022077JakobZorz비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#include"biscuits.h" #include<map> typedef long long ll; using namespace std; ll x; ll coins[120]; unordered_map<ll,ll>dp[120]; ll count(int i,ll num){ if(i==120) return 1; if(dp[i].count(num)) return dp[i][num]; ll res=0; if(num>=x){ res+=count(i+1,coins[i+1]+(num-x)/2); } res+=count(i+1,coins[i+1]+num/2); dp[i][num]=res; return res; } ll count_tastiness(ll X,vector<ll>a){ x=X; for(int i=0;i<120;i++){ coins[i]=0; dp[i].clear(); } for(int i=0;i<(int)a.size();i++) coins[i]=a[i]; return count(0,coins[0]); }

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

biscuits.cpp:8:1: error: 'unordered_map' does not name a type
    8 | unordered_map<ll,ll>dp[120];
      | ^~~~~~~~~~~~~
biscuits.cpp: In function 'll count(int, ll)':
biscuits.cpp:13:8: error: 'dp' was not declared in this scope
   13 |     if(dp[i].count(num))
      |        ^~
biscuits.cpp:20:5: error: 'dp' was not declared in this scope
   20 |     dp[i][num]=res;
      |     ^~
biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:28:9: error: 'dp' was not declared in this scope
   28 |         dp[i].clear();
      |         ^~
biscuits.cpp:30:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |     for(int i=0;i<(int)a.size();i++)
      |     ^~~
biscuits.cpp:32:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |  return count(0,coins[0]);
      |  ^~~~~~