Submission #62515798
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;#define ull unsigned long long#define ll long long#define pii pair<int,int>void solve() {int n;cin >> n;vector<int> p(n+9),q(n+9);for (int i = 1; i <= n; i++) {cin >> p[i];}for (int i = 1; i <= n; i++) {cin >> q[i];}vector<int> ans(n+9);for (int i = 1; i <= n; i++) {int a = q[i];ans[a] = q[p[i]];
#include <bits/stdc++.h> using namespace std; #define ull unsigned long long #define ll long long #define pii pair<int,int> void solve() { int n; cin >> n; vector<int> p(n+9),q(n+9); for (int i = 1; i <= n; i++) { cin >> p[i]; } for (int i = 1; i <= n; i++) { cin >> q[i]; } vector<int> ans(n+9); for (int i = 1; i <= n; i++) { int a = q[i]; ans[a] = q[p[i]]; } for (int i = 1; i <= n; i++) cout << ans[i] << " "; } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; for (int i = 0; i < t; i++) { solve(); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Bib |
User | CirnoNine |
Language | C++ 23 (gcc 12.2) |
Score | 300 |
Code Size | 694 Byte |
Status | AC |
Exec Time | 46 ms |
Memory | 6520 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
min.txt | AC | 1 ms | 3464 KB |
random_01.txt | AC | 45 ms | 6520 KB |
random_02.txt | AC | 2 ms | 3624 KB |
random_03.txt | AC | 46 ms | 6472 KB |
random_04.txt | AC | 7 ms | 3612 KB |
random_05.txt | AC | 46 ms | 6412 KB |
random_06.txt | AC | 11 ms | 3848 KB |
random_07.txt | AC | 46 ms | 6452 KB |
random_08.txt | AC | 43 ms | 6152 KB |
random_09.txt | AC | 45 ms | 6432 KB |
random_10.txt | AC | 20 ms | 4596 KB |
sample_01.txt | AC | 1 ms | 3440 KB |
sample_02.txt | AC | 1 ms | 3332 KB |