QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#744188 | #9623. 合成大西瓜 | QOJeric | WA | 0ms | 3440kb | C++17 | 641b | 2024-11-13 21:05:37 | 2024-11-13 21:05:42 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int n,m;cin>>n>>m;
vector<int>deg(n+1,0);
vector<int>w(n+1);
for(int i=1;i<=n;i++)cin>>w[i];
while(m--){
int u,v;cin>>u>>v;
deg[u]++;
deg[v]++;
}
vector<int>deg1;
int deg2=0;
for(int i=1;i<=n;i++){
if(deg[i]==1)
deg1.push_back(w[i]);
else
deg2=max(deg2,w[i]);
}
if(deg1.size()<2){
cout<<deg2;
return 0;
}
sort(deg1.begin(),deg1.end(),[](int a,int b){
return a>b;
});
cout<<deg1[1];
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3440kb
input:
7 9 1 4 1 3 3 6 7 5 4 3 6 3 4 2 3 5 2 2 6 6 7 5 1 4 6
output:
1
result:
wrong answer 1st lines differ - expected: '6', found: '1'