QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747870 | #9623. 合成大西瓜 | AmiyaCast# | WA | 0ms | 3540kb | C++20 | 983b | 2024-11-14 18:32:11 | 2024-11-14 18:32:12 |
Judging History
answer
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define pii pair<ll, ll>
const ll inf = 2e18;
const double eps = 1e-9;
using namespace std;
#define int long long
void slv(){
ll n, m; cin >> n >> m;
vector<pii> a(n + 1); for(int i = 1; i <= n; ++i) {
cin >> a[i].first;
a[i].second = i;
}
if(n == 1) {
cout << a[1].first << endl;
return ;
}
vector<int> in(n + 1);
for(int cnm = 1, x, y; cnm <= m; ++cnm) {
cin >> x >> y;
in[x]++, in[y]++;
}
sort(a.begin(), a.end(), [&](pii x, pii y) {
return x.first > y.first;
});
if(in[a[1].second] >= 2) {
cout << a[1].first << endl;
} else {
cout << a[2].first << endl;
}
}
main(){
//ios::sync_with_stdio(0), cin.tie(0);
int _ = 1;
//cin >> _;
while(_--) slv();
return 0;
}
/*
7 7
1 1 2 3 1 2 1
1 2
2 3
1 3
2 4
2 5
5 6
5 7
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
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:
6
result:
ok single line: '6'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3540kb
input:
5 7 1 5 3 1 4 3 5 1 3 5 1 1 4 5 4 2 4 3 2
output:
4
result:
wrong answer 1st lines differ - expected: '5', found: '4'