Submission #76439874
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LONGMAX 1e18
#define INTMAX 2147483647
int main(void)
{
int N;
cin >> N;
vector<int> A(N, 0), B(N, 0);
for (int i = 0; i < N; i++)
{
cin >> A[i];
A[i]--;
}
for (int i = 0; i < N; i++)
{
cin >> B[i];
B[i]--;
}
// i == B[A[i]]なら正直もの、そうでないなら嘘
int ans = 0;
for (int i = 0; i < N; i++)
{
if (i != B[A[i]])
{
ans++;
}
}
if (ans == 0)
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - The Honest Woodcutters |
| User | lalashvbp |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 712 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3596 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 | 3484 KiB |
| 00_sample_02.txt | AC | 1 ms | 3544 KiB |
| 00_sample_03.txt | AC | 1 ms | 3484 KiB |
| 01_01.txt | AC | 1 ms | 3596 KiB |
| 01_02.txt | AC | 1 ms | 3596 KiB |
| 02_01.txt | AC | 1 ms | 3528 KiB |
| 02_02.txt | AC | 1 ms | 3456 KiB |
| 03_01.txt | AC | 1 ms | 3456 KiB |
| 03_02.txt | AC | 1 ms | 3484 KiB |
| 04_01.txt | AC | 1 ms | 3432 KiB |
| 04_02.txt | AC | 1 ms | 3416 KiB |
| 04_03.txt | AC | 1 ms | 3424 KiB |
| 04_04.txt | AC | 1 ms | 3540 KiB |