Submission #62545527


Source Code Expand

Copy
#include <iostream>
using namespace std;
const int N = 300010;
struct people {
int id;
int ap, pa;
} p[N];
int main() {
int id_p[N];//idx;
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> p[i].ap;
p[p[i].ap].pa = p[i].id;
}
for (int i = 1; i <= n; i ++) {
cin >> p[i].id;
id_p[p[i].id] = i;
}
for (int i = 1; i <= n; i++)
cout << p[p[id_p[i]].ap].id << " ";
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
using namespace std;
const int N = 300010;
struct people {
	int id;
	int ap, pa;
} p[N];
int main() {
	int id_p[N];//id为x的人在哪;
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i].ap;
		p[p[i].ap].pa = p[i].id;
	}
	for (int i = 1; i <= n; i ++) {
		cin >> p[i].id;
		id_p[p[i].id] = i;
	}
	for (int i = 1; i <= n; i++)
		cout << p[p[id_p[i]].ap].id << " ";
	return 0;
}

Submission Info

Submission Time
Task C - Bib
User youzhiyingshi
Language C++ 20 (gcc 12.2)
Score 300
Code Size 433 Byte
Status AC
Exec Time 148 ms
Memory 8228 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 13
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 2 ms 4776 KB
random_01.txt AC 146 ms 8228 KB
random_02.txt AC 4 ms 4744 KB
random_03.txt AC 148 ms 8172 KB
random_04.txt AC 17 ms 5120 KB
random_05.txt AC 147 ms 8140 KB
random_06.txt AC 30 ms 5520 KB
random_07.txt AC 146 ms 8140 KB
random_08.txt AC 131 ms 7844 KB
random_09.txt AC 143 ms 8176 KB
random_10.txt AC 58 ms 6184 KB
sample_01.txt AC 2 ms 4772 KB
sample_02.txt AC 1 ms 4712 KB


2025-03-28 (Fri)
05:40:07 +00:00