Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>
#include<iomanip>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

#define INF 1<<16
#define min_3(a, b, c) min(a, min(b, c));
typedef long long ll;

int main()
{
  int d, g;
  cin >> d >> g;
  vector<ll> p(d), c(d);
  for (int i = 0; i < d; i++)
  {
    cin >> p[i] >> c[i];
  }

  ll ans = INF;
  for (int mask = 0; mask < (1 << d); mask++)
  {
    int s = 0, num = 0, rest_max = 0;
    for (int i = 0; i < d; i++)
    {
      if(mask >> i & 1) //完全に解く
      {
        s += 100 * (i + 1) * p[i] + c[i];
        num += p[i]; //解いた個数
      }
      else
      {
        rest_max = i; //まったく解かない
      }
    }
    if(s < g){ //まだ足りなかったとき，中途半端に解く配点を探す
      int s1 = 100 * (rest_max + 1);
      int need = (g - s + s1 - 1) / s1; //あと何問必要？
      if(need >= p[rest_max]) //まだ完全に解けるとこあるよね
      {
        continue;
      }
      num += need;
    }
    ans = min(ans, num);
  }
  
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:14: error: no matching function for call to 'min(ll&, int&)'
   53 |     ans = min(ans, num);
      |           ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:53:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   53 |     ans = min(ans, num);
      |           ~~~^~~~~~~~~~
/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,
                 from a.cc:4:
/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:53:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   53 |     ans = min(ans, num);
      |           ~~~^~~~~~~~~~