QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#764102 | #9623. 合成大西瓜 | Darwin_Arnold | WA | 1ms | 6008kb | C++20 | 647b | 2024-11-20 00:18:37 | 2024-11-20 00:18:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int w[N];
vector<int>G[N];
int main()
{
int n,m;
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i++)
{
scanf("%d",&w[i]);
}
for(int i=1;i<=m;i++)
{
int x,y;
scanf("%d %d",&x,&y);
G[x].push_back(y);
G[y].push_back(x);
}
int ans_1=0;
int ans_2=114514;
for(int i=1;i<=n;i++)
{
if(G[i].size()>1)ans_1=max(w[i],ans_1);
else if(G[i].size()==1)ans_2=min(ans_2,w[i]);
}
if(n==1)printf("%d\n",w[1]);
else printf("%d\n",max(ans_1,ans_2));
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 6008kb
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: 1ms
memory: 3840kb
input:
5 7 1 5 3 1 4 3 5 1 3 5 1 1 4 5 4 2 4 3 2
output:
114514
result:
wrong answer 1st lines differ - expected: '5', found: '114514'