QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#742149 | #9623. 合成大西瓜 | 123BVN | WA | 0ms | 5576kb | C++23 | 726b | 2024-11-13 15:59:11 | 2024-11-13 15:59:14 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int a[N],zhi[N];
void solve() {
int n, m, mx = 0, mx1 = 0, mx2 = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] == mx1) {
mx2 = max(a[i], mx2);
}
else {
mx1 = max(a[i], mx1);
mx2 = mx1;
}
}
while (m--) {
int u, v;
cin >> u>> v;
zhi[u]++;
zhi[v]++;
}
int ans=mx2;
for (int i = 1; i <= n; i++) {
if (a[i] == mx1) {
if (zhi[i] != 1)ans = mx1;
}
}
cout << ans <<endl;
}
signed main() {
int _ = 1;
// cin >> _;
while (_--) {
solve();
}
}
/*
7 7
1 1 2 3 1 2 1
1 2
2 3
1 3
2 4
2 5
5 6
5 7
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 5576kb
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'