QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#792923#9623. 合成大西瓜happy_lazier#WA 0ms3584kbC++20734b2024-11-29 15:05:312024-11-29 15:05:32

Judging History

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

  • [2024-11-29 15:05:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3584kb
  • [2024-11-29 15:05:31]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=l;i<=r;++i)
#define rep_(i,r,l) for(ll i=r;i>=l;--i)
const ll N = 2e5 + 7;
const ll P = 1e9 + 7;

ll a[N], in[N];
void solve() {
	ll n, m; cin >> n >> m;
	rep(i, 1, n) cin >> a[i];
	if (n == 1) { cout << a[1] << endl; return; }
	rep(i, 1, m) {
		ll u, v; cin >> u >> v;
		in[u]++, in[v]++;
	}
	ll ans = 0;
	ll ans2 = 1e9;
	rep(i, 1, n) {
		if (in[i] < 2) ans2 = min(ans2, a[i]);
		else ans = max(ans, a[i]);
	}
	cout << max(ans, ans2) << endl;
}
int main() {
	//cout << fixed << setprecision(0) << 0.500 << endl;
	ios::sync_with_stdio(0);
	cin.tie(0);
	int T(1);
	//cin >> T;
	while (T--) {
		solve();
	}
}

詳細信息

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: 3584kb

input:

5 7
1 5 3 1 4
3 5
1 3
5 1
1 4
5 4
2 4
3 2

output:

1000000000

result:

wrong answer 1st lines differ - expected: '5', found: '1000000000'