QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#754584#9623. 合成大西瓜Yori#Compile Error//C++20913b2024-11-16 15:21:472024-11-16 15:21:47

Judging History

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

  • [2024-11-16 15:21:47]
  • 评测
  • [2024-11-16 15:21:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
typedef long long ll;
typedef pair<int, int> PII;
const int N = 2e5+7;
int n, m, k;
int a[N];

void sovle()
{
    cin>>n>>m;
    vector<int>v[n+5];
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=m;i++){
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    int max1=0;
    for(int i=1;i<=n;i++){
        if(v[i].size()>=2) max1=max(max1,a[i]);
        else continue;
        int min1=2e12;
        for(auto ed:v[i]){
            min1=min(min1,[ed]);
        }
        max1=max(max1,min1);
    }
    if(n==1) cout<<a[1];
    else cout<<max1<<endl;
}

signed main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int ING = 1;
    //cin>>ING;
    while (ING--)
    {
        sovle();
    }
    
    return 0;
}

Details

answer.code: In lambda function:
answer.code:28:31: error: expected ‘{’ before ‘)’ token
   28 |             min1=min(min1,[ed]);
      |                               ^
answer.code: In function ‘void sovle()’:
answer.code:28:21: error: no matching function for call to ‘min(long long int&, sovle()::<lambda()>)’
   28 |             min1=min(min1,[ed]);
      |                  ~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
answer.code:28:21: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘sovle()::<lambda()>’)
   28 |             min1=min(min1,[ed]);
      |                  ~~~^~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
answer.code:28:21: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘sovle()::<lambda()>’)
   28 |             min1=min(min1,[ed]);
      |                  ~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)’
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
answer.code:28:21: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   28 |             min1=min(min1,[ed]);
      |                  ~~~^~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
answer.code:28:21: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   28 |             min1=min(min1,[ed]);
      |                  ~~~^~~~~~~~~~~