237502026-01-28 18:20:21algoproBányász RPG (40 pont)cpp17Forditási hiba
// UUID: 31d49990-0cfc-4481-bd8f-a344fd4acdbc
#include <bits/stdc++.h>
#include <csetjmp>
using namespace std;

int main() {
	int n; cin >> n;
    vector<pair<int, int>> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i].first;
    }
    for (int i = 0; i < n; i++) {
        cin >> l[i].second;
    }

    sort(l.begin(), l.end());

    long long xp = 0, t = 0;
    int i = 0, j = n-1;
    while (i <= j) {
        if (xp >= l[i].first) {
            xp += l[i].second;
            t += l[i].second;
            i++;
        } else {
            long long kell = l[i].first - xp;
            long long vesz = min(kell, l[j].second);

            t += 2 * vesz;
            xp += vesz;
            l[j].second -= vesz;

            if (l[j].second == 0) j--;
        }
    }

    cout << t;
}
Forditási hiba
open /var/local/lib/isolate/403/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:27:33: error: no matching function for call to 'min(long long int&, int&)'
   27 |             long long vesz = min(kell, l[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/bits/specfun.h:45,
                 from /usr/include/c++/12/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:41,
                 from main.cpp:2:
/usr/include/c++/12/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/12/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
main.cpp:27:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |             long long vesz = min(kell, l[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/12/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/12/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
main.cpp:27:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |             long long vesz = min(kell, l[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:65:
/usr/include/c++/12/bits/stl_algo.h:5726:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5726 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/12/bits/stl_algo.h:5726:5: note:   template argument deduction/s...