ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213778 | #582. t1 | yiwei | 0 | 358ms | 9068kb | C++11 | 604b | 2024-11-13 19:25:21 | 2024-11-13 23:01:53 |
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n,a[N];
vector<int> g[N];
void dfs(int x,int fa){
for (int y : g[x]){
if (y == fa) continue;
dfs(y,x);
}
cout << x << ' ';
}
int main(){
cin >> n;
for (int i = 2;i <= n;i++){
int x; cin >> x;
g[x].push_back(i);
}
for (int i = 1;i <= n;i++){
cin >> a[i];
}
for (int i = 1;i <= n;i++){
sort(g[i].begin(),g[i].end(),[](int x,int y){
return a[x] < a[y];
});
}
dfs(1,0);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
input:
100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ...
output:
75 84 89 69 55 54 67 79 95 68 90 91 72 52 87 77 66 60 98 70 57 82 86 92 96 94 85 99 65 80 74 59 81 7...
result:
wrong answer 1st numbers differ - expected: '52', found: '75'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
input:
100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ...
output:
76 58 87 97 72 86 80 85 70 61 96 84 79 98 56 57 99 53 52 75 59 55 54 82 65 95 78 90 68 60 67 94 91 9...
result:
wrong answer 1st numbers differ - expected: '97', found: '76'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
input:
100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ...
output:
73 95 51 64 58 94 61 75 54 53 89 88 98 99 91 81 57 72 85 80 69 84 97 100 83 82 63 55 65 70 66 76 77 ...
result:
wrong answer 1st numbers differ - expected: '68', found: '73'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
input:
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35...
output:
844 805 930 779 513 552 902 704 825 624 883 570 666 651 658 662 706 699 602 569 816 735 634 593 792 ...
result:
wrong answer 1st numbers differ - expected: '720', found: '844'
Test #5:
score: 0
Wrong Answer
time: 2ms
memory: 3652kb
input:
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35...
output:
953 513 857 737 744 947 981 772 734 540 938 862 992 553 505 984 812 536 842 729 993 967 945 562 832 ...
result:
wrong answer 1st numbers differ - expected: '993', found: '953'
Test #6:
score: 0
Wrong Answer
time: 2ms
memory: 3652kb
input:
1000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35...
output:
772 512 943 833 948 839 683 502 800 537 559 874 651 508 822 993 815 759 578 877 807 724 962 907 809 ...
result:
wrong answer 1st numbers differ - expected: '865', found: '772'
Test #7:
score: 0
Wrong Answer
time: 88ms
memory: 9060kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...
output:
96179 55393 88101 95691 62562 78210 81841 55567 53391 90371 85194 55160 85130 53907 51087 75681 7770...
result:
wrong answer 1st numbers differ - expected: '60966', found: '96179'
Test #8:
score: 0
Wrong Answer
time: 90ms
memory: 9064kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...
output:
75630 54532 97563 58554 61094 85122 77786 79598 51287 97566 87051 80591 56318 50345 78616 80624 7962...
result:
wrong answer 1st numbers differ - expected: '73271', found: '75630'
Test #9:
score: 0
Wrong Answer
time: 91ms
memory: 9068kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...
output:
55409 86568 86035 65432 76565 63582 61493 70050 63061 55284 92593 52685 70209 67774 51358 94036 5573...
result:
wrong answer 1st numbers differ - expected: '96945', found: '55409'
Test #10:
score: 0
Wrong Answer
time: 85ms
memory: 9064kb
input:
100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ...
output:
62189 59349 70230 56335 97435 99674 97088 53393 79564 66894 57369 86014 74213 93454 82081 79924 5686...
result:
wrong answer 1st numbers differ - expected: '86618', found: '62189'