QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743969#9623. 合成大西瓜sskWA 1ms3672kbC++231.5kb2024-11-13 20:28:172024-11-13 20:28:18

Judging History

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

  • [2024-11-13 20:28:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3672kb
  • [2024-11-13 20:28:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
typedef unsigned long long ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T> using min_heap=priority_queue<T,vector<T>,greater<T>>;
template<typename T> using max_heap=priority_queue<T>;
template<typename T> T isqrt(const T &x){T y=sqrt(x+2); while(y*y>x) y--; return y;}
const int INF = 1e18;
int a[100005];
vector<int>arr[100005];
map<int,int>mp;
void solve()
{
    int n,m,maxn1 = 0,maxn2 = 0;
    int du = 0;
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        mp[a[i]]++;
        maxn1 = max(maxn1,a[i]);
        if(a[i] < maxn1)
        {
            maxn2 = max(maxn2,a[i]);
        }
    }
    for(int i = 1;i <= m;i++)
    {
        int u,v;
        cin >> u >> v;
        arr[u].push_back(v);
        arr[v].push_back(u);
        if(a[u] == maxn1)
        {
            du = max(du,(int)arr[u].size());
        }
        if(a[v] == maxn1)
        {
            du = max(du,(int)arr[v].size());
        }
    }
    if(m == 0)
    {
        cout << a[1] << endl;
        return ;
    }
    if(mp[maxn1] > 1 || du > 1)
    {
        cout << maxn1 << endl;
    }
    else
    {
        cout << maxn2 << endl;
    }
    return;
}

signed main() 
{
    ios::sync_with_stdio(false),cin.tie(0);
    int tt = 1;
    while(tt--)
    {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3672kb

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:

3

result:

wrong answer 1st lines differ - expected: '6', found: '3'