QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738411#9623. 合成大西瓜chenjiaqiyWA 0ms3640kbC++201.1kb2024-11-12 19:00:102024-11-12 19:00:13

Judging History

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

  • [2024-11-12 19:00:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-11-12 19:00:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define double long double
#define endl '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define x first
#define y second
#define debug(_x) cout << #_x << '=' << _x << endl
typedef pair<int, int> PII;
using i64 = long long;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int v[N], d[N];

void solve()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> v[i];
    }
    while (m--)
    {
        int u, v;
        cin >> u >> v;
        d[u]++;
        d[v]++;
    }
    int ans = 0;
    if (n == 1)
    {
        cout << v[1] << endl;
        return;
    }
    for (int i = 1; i <= n; i++)
    {
        if (d[i] != 1)
        {
            ans = max(ans, v[i]);
        }
    }
    sort(v + 1, v + 1 + n, greater());
    ans = max(ans, v[1]);
    cout << ans << endl;
}

int main()
{
    /*ios::sync_with_stdio(false);
    cin.tie(nullptr);*/
    int _ = 1;
    // cin >> _;

    while (_--)
        solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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'