제출 #1087176

#제출 시각아이디문제언어결과실행 시간메모리
1087176Staheos은행 (IZhO14_bank)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>using namespace std;int main(){ int n, m; cin >> n >> m; auto a = new int[n]; auto b = new int[m]; auto dp = new int[1005]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < m; i++) {cin >> b[i];} for (int i = 1; i < 1005; i++) {dp[i] = -1;} dp[0] = 0; for (int i = 1; i < 1005; i++) { for (int j = 0; j < m; j++) { if (i < b[m]) { continue; } if (dp[i - b[m]] == -1) { continue; } if (dp[i] == -1) { dp[i] = dp[i - b[m]] + 1; } else if (dp[i] > dp[i - b[m]] + 1) { dp[i] = dp[i - b[m]] + 1; } } } for (int i = 0; i < n; i++) { cout << dp[a[i]] << '\n'; }}

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

bank.cpp:1:26: warning: extra tokens at end of #include directive
    1 | #include <iostream>using namespace std;int main(){  int n, m;  cin >> n >> m;  auto a = new int[n];  auto b = new int[m];  auto dp = new int[1005];    for (int i = 0; i < n; i++)    {    cin >> a[i];    }  for (int i = 0; i < m; i++)    {cin >> b[i];}  for (int i = 1; i < 1005; i++)    {dp[i] = -1;}  dp[0] = 0;    for (int i = 1; i < 1005; i++)  {    for (int j = 0; j < m; j++)    {       if (i < b[m])       {         continue;       }       if (dp[i - b[m]] == -1)       {         continue;       }       if (dp[i] == -1)       {         dp[i] = dp[i - b[m]] + 1;       }       else if (dp[i] > dp[i - b[m]] + 1)       {         dp[i] = dp[i - b[m]] + 1;       }    }  }  for (int i = 0; i < n; i++)  {    cout << dp[a[i]] << '\n';  }}
      |                          ^~~~~~~~~
bank.cpp:1:10: fatal error: iostream>usin: No such file or directory
    1 | #include <iostream>using namespace std;int main(){  int n, m;  cin >> n >> m;  auto a = new int[n];  auto b = new int[m];  auto dp = new int[1005];    for (int i = 0; i < n; i++)    {    cin >> a[i];    }  for (int i = 0; i < m; i++)    {cin >> b[i];}  for (int i = 1; i < 1005; i++)    {dp[i] = -1;}  dp[0] = 0;    for (int i = 1; i < 1005; i++)  {    for (int j = 0; j < m; j++)    {       if (i < b[m])       {         continue;       }       if (dp[i - b[m]] == -1)       {         continue;       }       if (dp[i] == -1)       {         dp[i] = dp[i - b[m]] + 1;       }       else if (dp[i] > dp[i - b[m]] + 1)       {         dp[i] = dp[i - b[m]] + 1;       }    }  }  for (int i = 0; i < n; i++)  {    cout << dp[a[i]] << '\n';  }}
      |          ^~~~~~~~~~~~~~~
compilation terminated.