QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747791 | #9623. 合成大西瓜 | sediment_# | WA | 0ms | 3816kb | C++20 | 1017b | 2024-11-14 18:16:48 | 2024-11-14 18:16:48 |
Judging History
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'