QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#754501#9623. 合成大西瓜Rosmontis_L#WA 0ms3588kbC++201.1kb2024-11-16 15:12:112024-11-16 15:12:11

Judging History

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

  • [2024-11-16 15:12:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-11-16 15:12:11]
  • 提交

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'