QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#809688 | #9623. 合成大西瓜 | Nana7# | WA | 1ms | 6448kb | C++14 | 799b | 2024-12-11 16:45:02 | 2024-12-11 16:45:19 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#define I inline
#define int long long
using namespace std;
const int N = 100010;
vector<int> q[N];
int n,m,a[N],du[N];
signed main()
{
cin>>n>>m;
for(int i=1;i<=n;++i) cin>>a[i];
if(n==1) {
cout<<a[1]<<endl;
return 0;
}
for(int i=1;i<=m;++i) {
int x,y; cin>>x>>y;
q[x].push_back(y);
q[y].push_back(x);
du[x]++; du[y]++;
}
int mx1=0,mx2=0,mx3=0;
for(int i=1;i<=n;++i) {
if(du[i]>2) {
mx1=max(mx1,a[i]);
} else {
if(a[i]>=mx2) {
mx3=mx2;
mx2=a[i];
} else if(a[i]>mx3) {
mx3=a[i];
}
}
}
cout<<max(mx1,mx3)<<endl;
}
/*
7 7
1 1 2 3 1 2 1
1 3
2 3
1 3
2 4
2 5
5 6
5 7
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6448kb
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: 5948kb
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'