QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764102#9623. 合成大西瓜Darwin_ArnoldWA 1ms6008kbC++20647b2024-11-20 00:18:372024-11-20 00:18:38

Judging History

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

  • [2024-11-20 00:18:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6008kb
  • [2024-11-20 00:18:37]
  • 提交

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'