QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#800221 | #9623. 合成大西瓜 | wjh111 | Compile Error | / | / | C++98 | 572b | 2024-12-06 00:31:30 | 2024-12-06 00:31:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
vector<int>p[100009];
int ans1=1e9,ans2=-1,v[100009],a[100009];
void dfs(int x){
if (p[x].size()==1){
ans1=min(ans1,a[x]);
if (x!=1)
return ;
}
else{
ans2=max(ans2,a[x]);
}
for (auto i : p[x]){
if (v[i]){
continue;
}
v[i]=1;
dfs(i);
}
}
int main(){
int n,x,y,m,i;
cin>>n>>m;
for (i=0;i<n;i++){
cin>>a[i+1];
}
for (i=0;i<m;i++){
cin>>x>>y;
p[x].push_back(y);
p[y].push_back(x);
}
v[1]=1;
dfs(1);
//cout<<ans1<<" "<<ans2<<" ";
cout<<max(ans1,ans2);
}
Details
answer.code: In function ‘void dfs(int)’: answer.code:14:19: error: ‘i’ does not name a type 14 | for (auto i : p[x]){ | ^ answer.code:20:10: error: expected ‘;’ before ‘}’ token 20 | } | ^ | ; 21 | } | ~ answer.code:21:1: error: expected primary-expression before ‘}’ token 21 | } | ^ answer.code:20:10: error: expected ‘;’ before ‘}’ token 20 | } | ^ | ; 21 | } | ~ answer.code:21:1: error: expected primary-expression before ‘}’ token 21 | } | ^ answer.code:20:10: error: expected ‘)’ before ‘}’ token 20 | } | ^ | ) 21 | } | ~ answer.code:14:13: note: to match this ‘(’ 14 | for (auto i : p[x]){ | ^ answer.code:21:1: error: expected primary-expression before ‘}’ token 21 | } | ^