제출 #575422

#제출 시각아이디문제언어결과실행 시간메모리
575422TrentRabbit Carrot (LMIO19_triusis)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "ext/pb_ds/assoc_container.hpp" using namespace std; using namespace __gnu_pbds; #define ll long long #define open(g) string _name_ = g; freopen((_name_ + ".in").c_str(), "r", stdin); freopen((_name_ + ".out").c_str(), "w", stdout) #define printArr(a, len) for(int asdf = 0; asdf < (len); ++asdf) cout << (a)[asdf] << ' '; cout << '\n'; #define boost() cin.sync_with_stdio(0); cin.tie(0) #define forR(i, x) for(int i = 0; i < x; ++i) #define REP(i, a, b) for(int i = (a); i < (b); ++i) #define all(i) i.begin(), i.end() #define pii pair<int, int> #define vi vector<int> #define si set<int> #define usi unordered_set<int> #define mii map<int, int> #define umii unordered_map<int, int> template <class K, class V> using ht = gp_hash_table<K, V, hash<K>, equal_to<K>, direct_mask_range_hashing<>, linear_probe_fn<>, hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<>, true>>; const int MIN = 1e9 + 100, MAX=2e9 + 100, MN = 2e5 + 10; gp_hash_table<int, int> bit; int& get(int i){ if(bit.find(i) == bit.end()) return bit[i] = MAX; return bit[i]; } void upd(int i, int diff){ i = MIN - i; assert(0 < i && i < MAX); for(; i < MAX; i += i&-i) get(i) = min(get(i), diff); } int qu(int i){ i = MIN - i; assert(0 < i && i < MAX); int ma = MAX; for(; i > 0; i -= i&-i) ma = min(ma, get(i)); return ma; } int dp[MN]; signed main() { int n, m; cin >> n >> m; upd(0, 0); REP(i, 1, n + 1){ int a; cin >> a; dp[i] = qu(a - i * m) + i - 1; upd(a - i * m, dp[i] - i); } ll mi = n; REP(i, 1, n + 1) { mi = min(mi, dp[i] + n - i); } cout << mi << '\n'; }

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

triusis.cpp: In function 'int main()':
triusis.cpp:56:35: error: no matching function for call to 'min(long long int&, int)'
   56 |         mi = min(mi, dp[i] + n - i);
      |                                   ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from triusis.cpp:1:
/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:
triusis.cpp:56:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   56 |         mi = min(mi, dp[i] + n - i);
      |                                   ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from triusis.cpp:1:
/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:
triusis.cpp:56:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   56 |         mi = min(mi, dp[i] + n - i);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from triusis.cpp:1:
/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:
triusis.cpp:56:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   56 |         mi = min(mi, dp[i] + n - i);
      |                                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from triusis.cpp:1:
/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:
triusis.cpp:56:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   56 |         mi = min(mi, dp[i] + n - i);
      |                                   ^