QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#747791#9623. 合成大西瓜sediment_#WA 0ms3816kbC++201017b2024-11-14 18:16:482024-11-14 18:16:48

Judging History

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

  • [2024-11-14 18:16:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-11-14 18:16:48]
  • 提交

answer

// Author: TrispdTit
// Date: 2024-11-14 15:46:03
//贪睡是一剂烈性毒品
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define ll long long
using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n + 10);
    vector<int> a(n + 10);
    for (int i = 1; i <= n ; i ++)cin >> a[i];
    if(m == 0){
        cout << a[1] << endl;
        return ;
    }
    while(m --){
        int x, y;
        cin >> x >> y;
        v[x] ++ ; v[y] ++;
    }

    vector<int> mi;
    int mx = 1;
    for (int i = 1 ; i <= n ; i ++){
        if(v[i] == 1)mi.push_back(a[i]);
        else mx = max(mx,a[i]);
    }
    if(mi.size() >= 2){
        sort(mi.begin(), mi.end());
        cout << max(mi[1],mx) << endl;
    }
    else {
        cout << mx << endl;
    }
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1;
    //cin >> t;
    while(t--) {
       solve();
    }

    return 0;
}

詳細信息

Test #1:

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

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:

7

result:

wrong answer 1st lines differ - expected: '6', found: '7'