提出 #76444079
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
void O_O() {
int n;
cin >> n;
int a[n + 1];
memset(a, -1, sizeof a);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a[x] = i + 1;
}
for (int i = 1; i <= n; i++) {
int b;
cin >> b;
// cout << a[b] << '\n';
if (a[i] != b) {
cout << "No";
return;
}
}
cout << "Yes";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
// cin >> TC;
while (TC--) {
O_O();
if (TC) cout << '\n';
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - The Honest Woodcutters |
| ユーザ | Mariouma |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 200 |
| コード長 | 672 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3636 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_01.txt, 01_02.txt, 02_01.txt, 02_02.txt, 03_01.txt, 03_02.txt, 04_01.txt, 04_02.txt, 04_03.txt, 04_04.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3588 KiB |
| 00_sample_02.txt | AC | 1 ms | 3516 KiB |
| 00_sample_03.txt | AC | 1 ms | 3428 KiB |
| 01_01.txt | AC | 1 ms | 3564 KiB |
| 01_02.txt | AC | 1 ms | 3588 KiB |
| 02_01.txt | AC | 1 ms | 3428 KiB |
| 02_02.txt | AC | 1 ms | 3608 KiB |
| 03_01.txt | AC | 1 ms | 3516 KiB |
| 03_02.txt | AC | 1 ms | 3564 KiB |
| 04_01.txt | AC | 1 ms | 3564 KiB |
| 04_02.txt | AC | 1 ms | 3376 KiB |
| 04_03.txt | AC | 1 ms | 3636 KiB |
| 04_04.txt | AC | 1 ms | 3436 KiB |