제출 #769894

#제출 시각아이디문제언어결과실행 시간메모리
769894teokakabadze선물상자 (IOI15_boxes)C++17
컴파일 에러
0 ms0 KiB
#include "boxes.h" #include<bits/stdc++.h> #define f first #define s second #define pb push_back #define ll long long #define NN 10000007 #define pii pair<int, int> using namespace std; ll n, k, a[NN], dp[NN], dp1[NN], ans, i, l; deque<pair<ll, ll> > d; long long delivery(int N, int K, int L, int p[]) { n = N, k = K; for(i = 0; i < n; i++) a[i] = p[i]; d.pb({0, -1}); for(i = 0; i < n; i++) { if(d.front().s == i - k - 1) d.pop_front(); dp[i] = min(L, 2 * a[i]) + d.front().f; while(d.size() && d.front().f >= dp[i]) d.pop_front(); d.pb({dp[i], i}); } while(d.size()) d.pop_back(); d.pb({0, n}); for(i = n - 1; i >= 0; i--) { if(d.front().s == i + k + 1) d.pop_front(); dp1[i] = min(L, 2 * (L - a[i])) + d.front().f; while(d.size() && d.front().f >= dp1[i]) d.pop_front(); d.pb({dp1[i], i}); } ans = 1e18; for(i = 0; i < n; i++) ans = min(ans, dp[i] + dp1[(i + 1) % n]); return min(min(dp[n - 1], dp1[0]), ans); }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:23:32: error: no matching function for call to 'min(int&, long long int)'
   23 |         dp[i] = min(L, 2 * a[i]) + d.front().f;
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:2:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   23 |         dp[i] = min(L, 2 * a[i]) + d.front().f;
      |                                ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:2:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:32: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   23 |         dp[i] = min(L, 2 * a[i]) + d.front().f;
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |         dp[i] = min(L, 2 * a[i]) + d.front().f;
      |                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
boxes.cpp:23:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   23 |         dp[i] = min(L, 2 * a[i]) + d.front().f;
      |                                ^
boxes.cpp:32:39: error: no matching function for call to 'min(int&, long long int)'
   32 |         dp1[i] = min(L, 2 * (L - a[i])) + d.front().f;
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:2:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
boxes.cpp:32:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   32 |         dp1[i] = min(L, 2 * (L - a[i])) + d.front().f;
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:2:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
boxes.cpp:32:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   32 |         dp1[i] = min(L, 2 * (L - a[i])) + d.front().f;
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
boxes.cpp:32:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |         dp1[i] = min(L, 2 * (L - a[i])) + d.front().f;
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
boxes.cpp:32:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |         dp1[i] = min(L, 2 * (L - a[i])) + d.front().f;
      |                                       ^