結果
| 問題 |
No.2184 A○B問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-13 21:48:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 611 bytes |
| コンパイル時間 | 1,553 ms |
| コンパイル使用メモリ | 62,548 KB |
| 最終ジャッジ日時 | 2025-02-10 02:26:14 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:9: error: ‘vector’ was not declared in this scope
8 | vector<int> a(5);
| ^~~~~~
main.cpp:5:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
4 | #include <numeric>
+++ |+#include <vector>
5 | using namespace std;
main.cpp:8:16: error: expected primary-expression before ‘int’
8 | vector<int> a(5);
| ^~~
main.cpp:9:16: error: expected primary-expression before ‘int’
9 | vector<int> b(5);
| ^~~
main.cpp:10:23: error: expected primary-expression before ‘int’
10 | vector<vector<int>> p(2,vector<int>(5));
| ^~~
main.cpp:13:32: error: ‘p’ was not declared in this scope
13 | cin >> p[i][j];
| ^
main.cpp:16:14: error: ‘a’ was not declared in this scope
16 | iota(a.begin(),a.end(),0);
| ^
main.cpp:19:25: error: ‘b’ was not declared in this scope
19 | b[p[1-i][j]-1] = a[j];
| ^
main.cpp:19:27: error: ‘p’ was not declared in this scope
19 | b[p[1-i][j]-1] = a[j];
| ^
main.cpp:21:24: error: ‘b’ was not declared in this scope
21 | swap(a,b);
| ^
main.cpp:23:16: error: expected primary-expression before ‘int’
23 | vector<int> ans(5);
| ^~~
main.cpp:25:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
25 | ans[a[i]] = i+1;
| ^~~
| abs
main.cpp:28:37: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
28 | if (i == 0) cout << ans[i];
| ^~~
ソースコード
#include<iostream>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
int main(){
int n;
vector<int> a(5);
vector<int> b(5);
vector<vector<int>> p(2,vector<int>(5));
for (int i = 0; i < 2;i++){
for (int j = 0; j < 5;j++){
cin >> p[i][j];
}
}
iota(a.begin(),a.end(),0);
for (int i = 0; i < 2;i++){
for (int j = 0; j < 5;j++){
b[p[1-i][j]-1] = a[j];
}
swap(a,b);
}
vector<int> ans(5);
for (int i = 0; i < 5;i++){
ans[a[i]] = i+1;
}
for (int i = 0; i < 5;i++){
if (i == 0) cout << ans[i];
else cout << " " << ans[i];
}
cout << endl;
return 0;
}