Submission #76456805
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
bool ans = true;
for (int i = 0; i < n; i++) { // b[a[i]-1] == i+1
if (b[a[i]-1] != i+1) {
ans = false;
break;
}
}
if (ans) {
cout << "Yes";
} else {
cout << "No";
}
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - The Honest Woodcutters |
| User | Frank678 |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 652 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3604 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3536 KiB |
| 00_sample_02.txt | AC | 1 ms | 3604 KiB |
| 00_sample_03.txt | AC | 1 ms | 3604 KiB |
| 01_01.txt | AC | 1 ms | 3540 KiB |
| 01_02.txt | AC | 1 ms | 3440 KiB |
| 02_01.txt | AC | 1 ms | 3440 KiB |
| 02_02.txt | AC | 1 ms | 3524 KiB |
| 03_01.txt | AC | 1 ms | 3484 KiB |
| 03_02.txt | AC | 1 ms | 3596 KiB |
| 04_01.txt | AC | 1 ms | 3536 KiB |
| 04_02.txt | AC | 1 ms | 3440 KiB |
| 04_03.txt | AC | 1 ms | 3536 KiB |
| 04_04.txt | AC | 1 ms | 3540 KiB |