Submission #1042115

#TimeUsernameProblemLanguageResultExecution timeMemory
10421150npataDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include<bits/stdc++.h> using namespace std; #define int long long #define vec vector const int MXN = 50'010; const int LOGN = 19; const int LOGS = 25; struct Data { int32_t mnt; int sum; int32_t v; }; Data binjmps[LOGS][MXN][LOGN]; int n; vec<int32_t> s; vec<int32_t> p; vec<int32_t> w; vec<int32_t> l; const int MXS = 1e8+100; void init(int32_t n_i, std::vector<int32_t> s_i, std::vector<int32_t> p_i, std::vector<int32_t> w_i, std::vector<int32_t> l_i) { // preprocessing fill in binjmps s = s_i; s.push_back(0); p = p_i; w = w_i; w.push_back(n_i); l = l_i; n = n_i; for(int i = 0; i<LOGS; i++) { for(int j = 0; j<=n; j++) { if(s[j] > (1<<i)) { binjmps[i][j][0] = {s[j], p[j], l[j]}; } else { binjmps[i][j][0] = {MXS, s[j], w[j]}; } } for(int k = 1; k<LOGN; k++) { for(int j = 0; j<=n; j++) { auto nxt = binjmps[i][binjmps[i][j][k-1].v][k-1]; auto me = binjmps[i][j][k-1]; int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt)); binjmps[i][j][k] = {min(me.mnt, nxt_mnt), me.sum+nxt.sum, nxt.v}; } } } return; } long long simulate(int32_t u, int32_t z) { int cur_s = z; for(int32_t i = 0; i<LOGS; i++) { //cerr << u << ' ' << cur_s << '\n'; for(int32_t j = LOGN-1; j>=0; j--) { if(binjmps[i][u][j].mnt > cur_s) { cur_s += binjmps[i][u][j].sum; u = binjmps[i][u][j].v; } } } return cur_s; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int32_t, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:52:88: error: no matching function for call to 'min(long long int&, int32_t&)'
   52 |                 int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt));
      |                                                                                        ^
In file included from /usr/include/c++/10/vector:60,
                 from dungeons.h:1,
                 from dungeons.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:
dungeons.cpp:52:88: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
   52 |                 int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt));
      |                                                                                        ^
In file included from /usr/include/c++/10/vector:60,
                 from dungeons.h:1,
                 from dungeons.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:
dungeons.cpp:52:88: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int32_t' {aka 'int'})
   52 |                 int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt));
      |                                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.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:
dungeons.cpp:52:88: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   52 |                 int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt));
      |                                                                                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.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:
dungeons.cpp:52:88: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   52 |                 int32_t nxt_mnt = (nxt.mnt == MXS) ? MXS : (nxt.mnt-min(me.sum, nxt.mnt));
      |                                                                                        ^