Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
struct ac
{
    int a,b,ii;
    friend bool operator < (const ac& a,const ac& b)
    {
        if(a.b!=b.b)
        return a.b>b.b;
        return a.a>b.a;
    }
}score[20];

int main()
{
    ll n,goal;
    cin>>n>>goal;
    for(int i=0;i<n;i++)
        {cin>>score[i].a>>score[i].b;score[i].ii=i;}
    ll sum=0,cnt=0;
    for(int i=0;i<n;i++)
    {
        int j;
        for(j=0;j<score[i].a;j++)
        {
            sum+=(i+1)*100;
            cnt++;
            if(sum>=goal)
                break;
        }
        if(j==score[i].a)
            sum+=score[i].b;
         if(sum>=goal)
                break;
    }
    //从前往后得到一个cnt
    sum=0;
    int cnt2=0;
    for(int i=n-1;i>=0;i--)
    {
        int j;
        for(j=0;j<score[i].a;j++)
        {
            sum+=(i+1)*100;
            cnt2++;
            if(sum>=goal)
                break;
        }
         if(j==score[i].a)
            sum+=score[i].b;
        if(sum>=goal)
            break;
    }
    int cnt3=0;
    sort(score,score+n);
    sum=0;
    for(int i=0;i<n;i++)
    {
        int j;
        for(j=0;j<score[i].a;j++)
        {
            sum+=(score[i].ii+1)*100;
            cnt3++;
            if(sum>=goal)
                break;
        }
        if(j==score[i].a)
            sum+=score[i].b;
         if(sum>=goal)
                break;
    }
    cnt=min(cnt,cnt3);
    cout<<min(cnt,cnt2)<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:12: error: no matching function for call to 'min(ll&, int&)'
   75 |     cnt=min(cnt,cnt3);
      |         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/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++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:75:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   75 |     cnt=min(cnt,cnt3);
      |         ~~~^~~~~~~~~~
/usr/include/c++/14/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++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:75:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   75 |     cnt=min(cnt,cnt3);
      |         ~~~^~~~~~~~~~
a.cc:76:14: error: no matching function for call to 'min(ll&, int&)'
   76 |     cout<<min(cnt,cnt2)<<endl;
      |           ~~~^~~~~~~~~~
/usr/include/c++/14/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++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:76:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   76 |     cout<<min(cnt,cnt2)<<endl;
      |           ~~~^~~~~~~~~~
/usr/include/c++/14/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++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:76:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   76 |     cout<<min(cnt,cnt2)<<endl;
      |           ~~~^~~~~~~~~~