UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213852#582. t1bigsmart210350ms9960kbC++11624b2024-11-13 22:01:032024-11-13 23:10:03

answer

#include<iostream>
#include<vector>
#include<queue>
#include<bits/stdc++.h>
using namespace std;
priority_queue< pair<int,int> ,vector<pair<int,int> > ,greater<pair<int,int> > > tree[112341];
int val[113212];
int a[114414];
int k,n;
void dfs(int p){
	while(!tree[p].empty()){
		auto y = tree[p].top();
		dfs(y.second);
		tree[p].pop();
	}
	if(tree[p].empty()){
		cout<<p<<" ";
	}
	return;
}
int main(){
	k = n;
	cin>>n;
	for(int i=2;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>val[i];
	}
	for(int i=2;i<=n;i++){
		tree[a[i]].push(make_pair(val[i],i));
	}
	dfs(1);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4756kb

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: 2ms
memory: 4756kb

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: 4760kb

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: 4804kb

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: 0ms
memory: 4808kb

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: 0ms
memory: 4800kb

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: 86ms
memory: 9960kb

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: 80ms
memory: 9960kb

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: 86ms
memory: 9960kb

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: 96ms
memory: 9960kb

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'