UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213846#582. t1bigsmart21Compile Error//C++624b2024-11-13 21:55:002024-11-13 23:09:23

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;
}

详细

answer.code: In function 'void dfs(int)':
answer.code:12:8: error: 'y' does not name a type
   auto y = tree[p].top();\x0d
        ^
answer.code:13:7: error: 'y' was not declared in this scope
   dfs(y.second);\x0d
       ^