# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1087037 | Staheos | 은행 (IZhO14_bank) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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:5:2: error: extended character is not valid in an identifier 5 | int n, m; | ^ bank.cpp:6:2: error: extended character is not valid in an identifier 6 | cin >> n >> m; | ^ bank.cpp:7:2: error: extended character is not valid in an identifier 7 | auto a = new int[n]; | ^ bank.cpp:8:2: error: extended character is not valid in an identifier 8 | auto b = new int[m]; | ^ bank.cpp:9:2: error: extended character is not valid in an identifier 9 | auto dp = new int[1005]; | ^ bank.cpp:10:2: error: extended character is not valid in an identifier 10 | | ^ bank.cpp:11:2: error: extended character is not valid in an identifier 11 | for (int i = 0; i < n; i++) | ^ bank.cpp:12:2: error: extended character is not valid in an identifier 12 | { | ^ bank.cpp:12:5: error: extended character is not valid in an identifier 12 | { | ^ bank.cpp:14:2: error: extended character is not valid in an identifier 14 | } | ^ bank.cpp:15:2: error: extended character is not valid in an identifier 15 | for (int i = 0; i < m; i++) | ^ bank.cpp:16:2: error: extended character is not valid in an identifier 16 | {cin >> b[i];} | ^ bank.cpp:16:5: error: extended character is not valid in an identifier 16 | {cin >> b[i];} | ^ bank.cpp:17:2: error: extended character is not valid in an identifier 17 | for (int i = 1; i < 1005; i++) | ^ bank.cpp:18:2: error: extended character is not valid in an identifier 18 | {dp[i] = -1;} | ^ bank.cpp:18:5: error: extended character is not valid in an identifier 18 | {dp[i] = -1;} | ^ bank.cpp:19:2: error: extended character is not valid in an identifier 19 | dp[0] = 0; | ^ bank.cpp:21:2: error: extended character is not valid in an identifier 21 | for (int i = 1; i < 1005; i++) | ^ bank.cpp:22:2: error: extended character is not valid in an identifier 22 | { | ^ bank.cpp:23:2: error: extended character is not valid in an identifier 23 | for (int j = 0; j < m; j++) | ^ bank.cpp:23:5: error: extended character is not valid in an identifier 23 | for (int j = 0; j < m; j++) | ^ bank.cpp:24:2: error: extended character is not valid in an identifier 24 | { | ^ bank.cpp:24:5: error: extended character is not valid in an identifier 24 | { | ^ bank.cpp:25:2: error: extended character is not valid in an identifier 25 | if (i < b[m]) | ^ bank.cpp:25:5: error: extended character is not valid in an identifier 25 | if (i < b[m]) | ^ bank.cpp:25:8: error: extended character is not valid in an identifier 25 | if (i < b[m]) | ^ bank.cpp:26:2: error: extended character is not valid in an identifier 26 | { | ^ bank.cpp:26:5: error: extended character is not valid in an identifier 26 | { | ^ bank.cpp:26:8: error: extended character is not valid in an identifier 26 | { | ^ bank.cpp:27:2: error: extended character is not valid in an identifier 27 | continue; | ^ bank.cpp:27:5: error: extended character is not valid in an identifier 27 | continue; | ^ bank.cpp:27:8: error: extended character is not valid in an identifier 27 | continue; | ^ bank.cpp:27:11: error: extended character is not valid in an identifier 27 | continue; | ^ bank.cpp:28:2: error: extended character is not valid in an identifier 28 | } | ^ bank.cpp:28:5: error: extended character is not valid in an identifier 28 | } | ^ bank.cpp:28:8: error: extended character is not valid in an identifier 28 | } | ^ bank.cpp:29:2: error: extended character is not valid in an identifier 29 | if (dp[i - b[m]] == -1) | ^ bank.cpp:29:5: error: extended character is not valid in an identifier 29 | if (dp[i - b[m]] == -1) | ^ bank.cpp:29:8: error: extended character is not valid in an identifier 29 | if (dp[i - b[m]] == -1) | ^ bank.cpp:30:2: error: extended character is not valid in an identifier 30 | { | ^ bank.cpp:30:5: error: extended character is not valid in an identifier 30 | { | ^ bank.cpp:30:8: error: extended character is not valid in an identifier 30 | { | ^ bank.cpp:31:2: error: extended character is not valid in an identifier 31 | continue; | ^ bank.cpp:31:5: error: extended character is not valid in an identifier 31 | continue; | ^ bank.cpp:31:8: error: extended character is not valid in an identifier 31 | continue; | ^ bank.cpp:31:11: error: extended character is not valid in an identifier 31 | continue; | ^ bank.cpp:32:2: error: extended character is not valid in an identifier 32 | } | ^ bank.cpp:32:5: error: extended character is not valid in an identifier 32 | } | ^ bank.cpp:32:8: error: extended character is not valid in an identifier 32 | } | ^ bank.cpp:33:2: error: extended character is not valid in an identifier 33 | if (dp[i] == -1) | ^ bank.cpp:33:5: error: extended character is not valid in an identifier 33 | if (dp[i] == -1) | ^ bank.cpp:33:8: error: extended character is not valid in an identifier 33 | if (dp[i] == -1) | ^ bank.cpp:34:2: error: extended character is not valid in an identifier 34 | { | ^ bank.cpp:34:5: error: extended character is not valid in an identifier 34 | { | ^ bank.cpp:34:8: error: extended character is not valid in an identifier 34 | { | ^ bank.cpp:35:2: error: extended character is not valid in an identifier 35 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:35:5: error: extended character is not valid in an identifier 35 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:35:8: error: extended character is not valid in an identifier 35 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:35:11: error: extended character is not valid in an identifier 35 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:36:2: error: extended character is not valid in an identifier 36 | } | ^ bank.cpp:36:5: error: extended character is not valid in an identifier 36 | } | ^ bank.cpp:36:8: error: extended character is not valid in an identifier 36 | } | ^ bank.cpp:37:2: error: extended character is not valid in an identifier 37 | else if (dp[i] > dp[i - b[m]] + 1) | ^ bank.cpp:37:5: error: extended character is not valid in an identifier 37 | else if (dp[i] > dp[i - b[m]] + 1) | ^ bank.cpp:37:8: error: extended character is not valid in an identifier 37 | else if (dp[i] > dp[i - b[m]] + 1) | ^ bank.cpp:38:2: error: extended character is not valid in an identifier 38 | { | ^ bank.cpp:38:5: error: extended character is not valid in an identifier 38 | { | ^ bank.cpp:38:8: error: extended character is not valid in an identifier 38 | { | ^ bank.cpp:39:2: error: extended character is not valid in an identifier 39 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:39:5: error: extended character is not valid in an identifier 39 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:39:8: error: extended character is not valid in an identifier 39 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:39:11: error: extended character is not valid in an identifier 39 | dp[i] = dp[i - b[m]] + 1; | ^ bank.cpp:40:2: error: extended character is not valid in an identifier 40 | } | ^ bank.cpp:40:5: error: extended character is not valid in an identifier 40 | } | ^ bank.cpp:40:8: error: extended character is not valid in an identifier 40 | } | ^ bank.cpp:41:3: error: extended character is not valid in an identifier 41 | } | ^ bank.cpp:41:3: error: extended character is not valid in an identifier bank.cpp:42:2: error: extended character is not valid in an identifier 42 | } | ^ bank.cpp:43:2: error: extended character is not valid in an identifier 43 | for (int i = 0; i < n; i++) | ^ bank.cpp:44:2: error: extended character is not valid in an identifier 44 | { | ^ bank.cpp:45:2: error: extended character is not valid in an identifier 45 | cout << dp[a[i]] << '\n'; | ^ bank.cpp:45:5: error: extended character is not valid in an identifier 45 | cout << dp[a[i]] << '\n'; | ^ bank.cpp:46:2: error: extended character is not valid in an identifier 46 | } | ^ bank.cpp: In function 'int main()': bank.cpp:5:2: error: '\U000000a0int' was not declared in this scope 5 | int n, m; | ^~~~ bank.cpp:6:2: error: '\U000000a0cin' was not declared in this scope 6 | cin >> n >> m; | ^~~~ bank.cpp:6:11: error: 'n' was not declared in this scope 6 | cin >> n >> m; | ^ bank.cpp:6:16: error: 'm' was not declared in this scope; did you mean 'tm'? 6 | cin >> n >> m; | ^ | tm bank.cpp:7:2: error: '\U000000a0auto' was not declared in this scope; did you mean 'auto'? 7 | auto a = new int[n]; | ^~~~~ | auto bank.cpp:8:8: error: expected ';' before 'b' 8 | auto b = new int[m]; | ^~ | ; bank.cpp:9:8: error: expected ';' before 'dp' 9 | auto dp = new int[1005]; | ^~~ | ; bank.cpp:10:2: error: '\U000000a0' was not declared in this scope 10 | | ^ bank.cpp:11:20: error: 'i' was not declared in this scope 11 | for (int i = 0; i < n; i++) | ^ bank.cpp:15:9: error: expected primary-expression before 'int' 15 | for (int i = 0; i < m; i++) | ^~~ bank.cpp:17:9: error: expected primary-expression before 'int' 17 | for (int i = 1; i < 1005; i++) | ^~~ bank.cpp:19:2: error: '\U000000a0dp' was not declared in this scope 19 | dp[0] = 0; | ^~~ bank.cpp:21:9: error: expected primary-expression before 'int' 21 | for (int i = 1; i < 1005; i++) | ^~~ bank.cpp:43:9: error: expected primary-expression before 'int' 43 | for (int i = 0; i < n; i++) | ^~~