QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#754501 | #9623. 合成大西瓜 | Rosmontis_L# | WA | 0ms | 3588kb | C++20 | 1.1kb | 2024-11-16 15:12:11 | 2024-11-16 15:12:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
//#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef tuple<ll, ll, ll> TLL;
int lowbit(int x) {return x & (- x);};
const int N = 200010, mod = 998244353;
const int Mod = 1e9 + 7, INF = 0x3f3f3f3f;
void solve(){
int n, m; cin >> n >> m;
vector<int> d(n + 1), a(n + 1);
for(int i = 1; i <= n; i ++) cin >> a[i];
for(int i = 1; i <= m; i ++) {
int u, v; cin >> u >> v;
d[u] ^= 1, d[v] ^= 1;
}
int odd = 1e9, eve = 0;
for(int i = 1; i <= n; i ++) {
if(d[i]) {
odd = min(odd, a[i]);
} else {
eve = max(eve, a[i]);
}
}
if(odd == 1e9) {
cout << eve << '\n';
} else {
cout << max(odd, eve) << '\n';
}
}
/*
7 7
1 1 2 3 1 2 1
1 2
2 3
1 3
2 4
2 5
5 6
5 7
*/
int main(){
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int t = 1;
// cin >> t;
while(t --){
solve();
}
// fclose(stdin);
// fclose(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
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: 0
Accepted
time: 0ms
memory: 3588kb
input:
5 7 1 5 3 1 4 3 5 1 3 5 1 1 4 5 4 2 4 3 2
output:
5
result:
ok single line: '5'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
7 7 2 4 2 3 3 6 7 5 1 2 6 5 3 4 6 1 6 1 2 2 7
output:
3
result:
wrong answer 1st lines differ - expected: '6', found: '3'