QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#744188#9623. 合成大西瓜QOJericWA 0ms3440kbC++17641b2024-11-13 21:05:372024-11-13 21:05:42

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 21:05:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3440kb
  • [2024-11-13 21:05:37]
  • 提交

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'