Submission #76447520
Source Code Expand
//競プロ C++テンプレ
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define ll long long
#define pb push_back
int main() {
int N;
cin >> N;
bool isok = true;
vector<pair<int,int>> vp(N);
for(int i = 0; i < N;i++){
cin >> vp.at(i).first;
}
for(int i = 0; i < N;i++){
cin >> vp.at(i).second;
}
for(int i = 0; i < N;i++){
int kk = vp.at(i).second - 1;
if(vp.at(kk).first - 1 != i){
isok = false;
break;
}
}
if(isok){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - The Honest Woodcutters |
| User | gumi11ta |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 655 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3600 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 | 3600 KiB |
| 00_sample_02.txt | AC | 1 ms | 3560 KiB |
| 00_sample_03.txt | AC | 1 ms | 3524 KiB |
| 01_01.txt | AC | 1 ms | 3588 KiB |
| 01_02.txt | AC | 1 ms | 3452 KiB |
| 02_01.txt | AC | 1 ms | 3532 KiB |
| 02_02.txt | AC | 1 ms | 3560 KiB |
| 03_01.txt | AC | 1 ms | 3560 KiB |
| 03_02.txt | AC | 1 ms | 3524 KiB |
| 04_01.txt | AC | 1 ms | 3436 KiB |
| 04_02.txt | AC | 1 ms | 3524 KiB |
| 04_03.txt | AC | 1 ms | 3500 KiB |
| 04_04.txt | AC | 1 ms | 3600 KiB |