Submission #76433129
Source Code Expand
// Date: 2026-06-06
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
bool debug_mode = 1;
#else
bool debug_mode = 0;
#endif
using ll = long long;
#define cerr if(debug_mode) cerr
int main() {
cin.tie(0) -> sync_with_stdio(0);
int n; cin >> n;
vector<int> a(n), b(n);
for (auto &i : a) cin >> i;
for (auto &i : b) cin >> i;
bool valid = 1;
for (int i = 0; i < n; i++)
{
if (b[a[i] - 1] - 1 != i)
{
valid = 0;
break;
}
}
cout << (valid ? "Yes" : "No");
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - The Honest Woodcutters |
| User | Emmetthor |
| Language | C++ IOI-Style(GNU++20) (GCC 14.2.0) |
| Score | 200 |
| Code Size | 600 Byte |
| Status | AC |
| Exec Time | 0 ms |
| Memory | 1620 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 | 0 ms | 1580 KiB |
| 00_sample_02.txt | AC | 0 ms | 1620 KiB |
| 00_sample_03.txt | AC | 0 ms | 1580 KiB |
| 01_01.txt | AC | 0 ms | 1580 KiB |
| 01_02.txt | AC | 0 ms | 1580 KiB |
| 02_01.txt | AC | 0 ms | 1580 KiB |
| 02_02.txt | AC | 0 ms | 1580 KiB |
| 03_01.txt | AC | 0 ms | 1580 KiB |
| 03_02.txt | AC | 0 ms | 1580 KiB |
| 04_01.txt | AC | 0 ms | 1580 KiB |
| 04_02.txt | AC | 0 ms | 1580 KiB |
| 04_03.txt | AC | 0 ms | 1580 KiB |
| 04_04.txt | AC | 0 ms | 1580 KiB |