Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, a[1500];
- pair <int, int> b[1500];
- int main(){
- //freopen("D.in", "r", stdin);
- //freopen("D.out", "w", stdout);
- cin >> n;
- for(int i = 1; i <= n; i++){
- cin >> a[i];
- }
- for(int i = 1; i <= n; i++){
- cin >> b[i].first;
- b[i].second = i;
- }
- for(int i = 1; i <= n; i++){
- cout << b[a[i]].second<< " " << i << endl;
- if(b[a[i]].first != i){
- cout << "NO";
- return 0;
- }
- }
- cout << "YES" << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment