제출 #1365125

#제출 시각아이디문제언어결과실행 시간메모리
1365125haiphong5g0나일강 (IOI24_nile)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define task "TEST"
#define task2 "A"
#define pl pair<ll, ll>
#define VI vector<int>
#define VL vector<ll>
#define pf push_front
#define pb push_back
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b, c) for (int i=a; i<=b; i+=c)
#define FORE(i, a, b, c) for (int i=a; i>=b; i+=c)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int Mod = 1e9+7;
const int maxn = 2e5;
const ll Inf = 1e16;
ll n, q;
VL calculate_costs(VI W, VI A, VI B, VI E) {
    q = E.size(); n = W.size();
    ll sum = 0, mn = Inf; VL res;
    FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
    FOR(i, 0, q-1, 1) {
        if (n % 2 == 1) res.pb(sum + mn);
        else res.pb(sum);
    }
    return res;
}
/*void Read()
{
    
}
void Solve()
{
    
}
int main()
{
    if (fopen (task".inp", "r")) {
        freopen (task".inp", "r", stdin);
        freopen (task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    for (cin >> t; t--;)
    {
        Read(); Solve();
    }
}*/

컴파일 시 표준 에러 (stderr) 메시지

nile.cpp: In function 'std::vector<long long int> calculate_costs(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
nile.cpp:26:44: error: no matching function for call to 'min(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   26 |     FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
      |                                         ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from nile.cpp: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:
nile.cpp:26:44: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   26 |     FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
      |                                         ~~~^~~~~~~~~~~~~~~~~
/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:
nile.cpp:26:44: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   26 |     FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
      |                                         ~~~^~~~~~~~~~~~~~~~~
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:
nile.cpp:26:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |     FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
      |                                         ~~~^~~~~~~~~~~~~~~~~
/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:
nile.cpp:26:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   26 |     FOR(i, 0, n-1, 1) sum += B[i], mn = min(mn, A[i] - B[i]);
      |                                         ~~~^~~~~~~~~~~~~~~~~