fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <cstdint>
  4. #include <tuple>
  5. #include <algorithm>
  6. #include <array>
  7.  
  8. //not debug some function.
  9.  
  10. typedef std::vector<std::vector<std::uint64_t>> MapType;
  11. typedef std::tuple<std::int64_t, std::int64_t> Point;
  12. typedef std::vector<Point> FootPrint;
  13.  
  14. int Pa = 2;
  15.  
  16. std::uintmax_t PoorSearch(const MapType& M, const Point& Fst, const Point& Last) {
  17.  
  18. std::uintmax_t W = 0;
  19. std::int64_t i = 0;
  20. std::size_t j = 0;
  21. for (j= std::get<1>(Fst);j != std::get<1>(Last); j += (std::get<1>(Fst) - std::get<1>(Last)) ? 1 : -1) {
  22. W += M[j][std::get<0>(Fst)];
  23. }
  24.  
  25. for (i = std::get<0>(Fst); i != std::get<0>(Last); i += (std::get<0>(Fst) - std::get<0>(Last)) ? 1 : -1) {
  26. W += M[j-1][i];
  27. }
  28.  
  29. return W;
  30. }
  31. /**/
  32. bool SearchPath_r(const MapType& M, FootPrint FP, const Point& Now, const Point& Last, const std::uintmax_t& Wait, std::intmax_t& Min,FootPrint& FPR) {
  33. static std::array<int, 4> XP = { 0,1,0,-1 };
  34. static std::array<int, 4> YP = { 1,0,-1,0 };
  35. static std::uintmax_t C = 0;
  36.  
  37. auto X1 = std::get<0>(Now);
  38. auto Y1 = std::get<1>(Now);
  39. auto X2 = std::max<int>(std::get<0>(Last)-1, 0);
  40. auto Y2 = std::max<int>(std::get<1>(Last)-1, 0);
  41. if ((X1 == X2) && (Y1 == Y2)) {
  42. if (Min >= Wait) {
  43. FP.push_back({ X1,Y1 });
  44. Min = Wait;
  45. C++;
  46. FPR = FP;
  47. //ESS::Locate(15, 0);
  48. //std::cout << C;
  49. }
  50. //ESS::Locate(std::get<0>(Now)+Pa, std::get<1>(Now)+Pa);
  51. //std::cout << ' ';
  52. return true;
  53. }
  54.  
  55. if (Min <= Wait) {
  56. //ESS::Locate(std::get<0>(Now)+Pa, std::get<1>(Now)+Pa);
  57. //std::cout << ' ';
  58. return false;
  59. }
  60. //ESS::Locate(std::get<0>(Now)+Pa, std::get<1>(Now)+Pa);
  61. //std::cout << '*' ;
  62. FP.push_back({ std::get<0>(Now),std::get<1>(Now) });
  63. for (std::size_t i = 0; i < 4; i++) {
  64. if (std::get<0>(Now) + XP[i] < 0) { continue; };
  65. if (std::get<1>(Now) + YP[i] < 0) { continue; };
  66. if (std::get<0>(Now) + XP[i] >= M.front().size() ) { continue; }
  67. if (std::get<1>(Now) + YP[i] >= M.size()) { continue; }
  68. auto it = std::find_if(FP.begin(), FP.end(), [&](auto& o) {return (std::get<0>(o) == std::get<0>(Now) + XP[i]) && (std::get<1>(o) == std::get<1>(Now) + YP[i]); });
  69.  
  70. if (it != FP.end()) { continue; }
  71.  
  72.  
  73. SearchPath_r(M, FP,{ std::get<0>(Now) + XP[i],std::get<1>(Now) + YP[i] }, Last, Wait + M[std::get<1>(Now) + YP[i]][std::get<0>(Now) + XP[i]], Min,FPR);
  74.  
  75.  
  76.  
  77. }
  78. FP.pop_back();
  79. //ESS::Locate(std::get<0>(Now)+Pa, std::get<1>(Now)+Pa);
  80. //std::cout << ' ';
  81. return true;
  82.  
  83.  
  84.  
  85. }
  86.  
  87. std::tuple<std::uintmax_t,FootPrint> SearchPath(const MapType& M, const Point& Fst, const Point& Last) {
  88. std::intmax_t Min = PoorSearch(M, Fst, Last);
  89. FootPrint fp;
  90. FootPrint FPR;
  91. //fp.push_back({ 0,0 });
  92. //ESS::Locate(std::get<0>(Fst)+Pa, std::get<1>(Fst)+Pa);
  93. //std::cout << '*';
  94. SearchPath_r(M, fp, Fst, Last, 0, Min,FPR);
  95.  
  96. return { Min,FPR };
  97.  
  98. }
  99.  
  100. typedef std::tuple<Point, std::uint64_t,std::uintmax_t,std::uintmax_t> FootData;//pos,dir,weight,now_weight
  101. typedef std::vector<FootData> FootPrint2;
  102.  
  103. std::tuple<std::uintmax_t,FootPrint2> SearchPathL(const MapType& M, const Point& Fst, const Point& Last){
  104. static std::array<int, 4> XP = { 0,1,0,-1 };
  105. static std::array<int, 4> YP = { 1,0,-1,0 };
  106. std::uintmax_t MinWeight = PoorSearch(M, Fst, Last);
  107. std::uintmax_t Weight = 0;
  108.  
  109. FootPrint2 FP;
  110. FootPrint2 R;
  111.  
  112. FP.push_back({ Fst,0,0,0 });
  113.  
  114. while (FP.size()) {
  115. for (std::get<1>(FP.back()); std::get<1>(FP.back()) < 4; std::get<1>(FP.back())++) {
  116. auto i = std::get<1>(FP.back());
  117. auto& o = FP.back();
  118. auto& P = std::get<0>(o);
  119.  
  120. if (std::get<0>(P) + XP[i] < 0) { continue; }
  121. if (std::get<1>(P) + YP[i] < 0) { continue; }
  122. if (std::get<0>(P) + XP[i] >= M.front().size()) { continue; }
  123. if (std::get<1>(P) + YP[i] >= M.size()) { continue; }
  124.  
  125. auto X = std::get<0>(P) + XP[i];
  126. auto Y = std::get<1>(P) + YP[i];
  127.  
  128. auto it = std::find_if(FP.begin(), FP.end(), [&](auto& o) {return (std::get<0>(std::get<0>(o)) == X) && (std::get<1>(std::get<0>(o)) == Y); });
  129. if (it != FP.end()) { continue; }
  130.  
  131. if (Weight + M[Y][X] >= MinWeight) {
  132. //FP.pop_back();
  133. continue;
  134. }
  135. Weight += M[Y][X];
  136. if (X == std::get<0>(Last) && Y == std::get<1>(Last)) {
  137. if (Weight < MinWeight) {
  138. R = FP;
  139. MinWeight = Weight;
  140.  
  141. }
  142. FP.pop_back();
  143. continue;
  144. }
  145. FP.push_back({ { X,Y },0, M[Y][X], Weight });
  146. }
  147. } return { MinWeight,R };
  148. }
  149.  
  150. MapType MakeVector() {
  151. MapType M{
  152. {0,2,9,5,3,9,4,1,3 },
  153. {7,1,5,4,6,7,9,8,8 },
  154. {8,3,4,1,1,2,9,4,6 },
  155. {2,3,7,1,6,5,4,2,6 },
  156. {4,7,3,8,5,7,3,6,0 },
  157. };
  158.  
  159. return M;
  160. }
  161.  
  162. int main() {
  163. MapType M = MakeVector();
  164. FootPrint FP;
  165. FootPrint2 FP2;
  166. std::uintmax_t R;
  167. //std::tie(R,FP) = SearchPath(M, { 0,0 }, { 9,5 });
  168. std::tie(R,FP2) = SearchPathL(M, { 0,0 }, { 9,5 });
  169. //ESS::Locate(0, 10);
  170. std::cout << R << std::endl;
  171. for (auto& o : FP2) {
  172. std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
  173. //std::cout << std::get<0>(std::get<0>(o)) << ',' << std::get<1>(std::get<0>(o)) << ',' << M[std::get<1>(std::get<0>(o))][std::get<0>(std::get<0>(o))] << std::endl;
  174. }
  175.  
  176. return 0;
  177. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:172:13: error: no match for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’)
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
   ~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:628:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::tuple<long int, long int>] <near match>
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^~~~~~~~
/usr/include/c++/6/ostream:628:5: note:   conversion of argument 1 would be ill-formed:
prog.cpp:172:29: error: cannot bind ‘std::ostream {aka std::basic_ostream<char>}’ lvalue to ‘std::basic_ostream<char>&&’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                             ^
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(__ostream_type& (*__pf)(__ostream_type&))
       ^~~~~~~~
/usr/include/c++/6/ostream:108:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&) {aka std::basic_ostream<char>& (*)(std::basic_ostream<char>&)}’
/usr/include/c++/6/ostream:117:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]
       operator<<(__ios_type& (*__pf)(__ios_type&))
       ^~~~~~~~
/usr/include/c++/6/ostream:117:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}’
/usr/include/c++/6/ostream:127:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(ios_base& (*__pf) (ios_base&))
       ^~~~~~~~
/usr/include/c++/6/ostream:127:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::ios_base& (*)(std::ios_base&)’
/usr/include/c++/6/ostream:166:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:166:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘long int’
/usr/include/c++/6/ostream:170:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:170:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘long unsigned int’
/usr/include/c++/6/ostream:174:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(bool __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:174:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘bool’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:91:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]
     basic_ostream<_CharT, _Traits>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:91:5: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘short int’
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:181:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned short __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:181:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘short unsigned int’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:105:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]
     basic_ostream<_CharT, _Traits>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:105:5: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘int’
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:192:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned int __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:192:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘unsigned int’
/usr/include/c++/6/ostream:201:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:201:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘long long int’
/usr/include/c++/6/ostream:205:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(unsigned long long __n)
       ^~~~~~~~
/usr/include/c++/6/ostream:205:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘long long unsigned int’
/usr/include/c++/6/ostream:220:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(double __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:220:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘double’
/usr/include/c++/6/ostream:224:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(float __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:224:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘float’
/usr/include/c++/6/ostream:232:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(long double __f)
       ^~~~~~~~
/usr/include/c++/6/ostream:232:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘long double’
/usr/include/c++/6/ostream:245:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]
       operator<<(const void* __p)
       ^~~~~~~~
/usr/include/c++/6/ostream:245:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘const void*’
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:119:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]
     basic_ostream<_CharT, _Traits>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:119:5: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::basic_ostream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}’
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:574:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*)
     operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
     ^~~~~~~~
/usr/include/c++/6/ostream:574:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘const unsigned char*’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:569:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*)
     operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
     ^~~~~~~~
/usr/include/c++/6/ostream:569:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘const signed char*’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:556:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*)
     operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
     ^~~~~~~~
/usr/include/c++/6/ostream:556:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘const char*’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/ostream:638:0,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/ostream.tcc:321:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*)
     operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
     ^~~~~~~~
/usr/include/c++/6/bits/ostream.tcc:321:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘const char*’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:539:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*)
     operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
     ^~~~~~~~
/usr/include/c++/6/ostream:539:5: note:   template argument deduction/substitution failed:
prog.cpp:172:29: note:   mismatched types ‘const _CharT*’ and ‘std::tuple<long int, long int>’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                             ^
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:519:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)
     operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
     ^~~~~~~~
/usr/include/c++/6/ostream:519:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘unsigned char’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:514:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char)
     operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
     ^~~~~~~~
/usr/include/c++/6/ostream:514:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘signed char’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:508:5: note: candidate: template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char)
     operator<<(basic_ostream<char, _Traits>& __out, char __c)
     ^~~~~~~~
/usr/include/c++/6/ostream:508:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘char’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:502:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char)
     operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
     ^~~~~~~~
/usr/include/c++/6/ostream:502:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘char’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/iostream:39:0,
                 from prog.cpp:1:
/usr/include/c++/6/ostream:497:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)
     operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
     ^~~~~~~~
/usr/include/c++/6/ostream:497:5: note:   template argument deduction/substitution failed:
prog.cpp:172:29: note:   deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘std::tuple<long int, long int>’)
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                             ^
In file included from /usr/include/c++/6/bits/ios_base.h:46:0,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/system_error:209:5: note: candidate: template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::error_code&)
     operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
     ^~~~~~~~
/usr/include/c++/6/system_error:209:5: note:   template argument deduction/substitution failed:
prog.cpp:172:27: note:   cannot convert ‘std::get<0ul, {std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int}>((* & o))’ (type ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’) to type ‘const std::error_code&’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                ~~~~~~~~~~~^~~
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/basic_string.h:5340:5: note: candidate: template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     operator<<(basic_ostream<_CharT, _Traits>& __os,
     ^~~~~~~~
/usr/include/c++/6/bits/basic_string.h:5340:5: note:   template argument deduction/substitution failed:
prog.cpp:172:29: note:   ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                             ^
prog.cpp:172:83: error: no match for ‘operator[]’ (operand types are ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<long unsigned int> > >::value_type {aka std::vector<long unsigned int>}’ and ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’)
   std::cout << std::get<0>(o) << ',' << std::get<1>(o) << ',' << M[std::get<1>(o)][std::get<0>(o)] << std::endl;
                                                                                   ^
In file included from /usr/include/c++/6/vector:64:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/stl_vector.h:780:7: note: candidate: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; std::vector<_Tp, _Alloc>::reference = long unsigned int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]
       operator[](size_type __n) _GLIBCXX_NOEXCEPT
       ^~~~~~~~
/usr/include/c++/6/bits/stl_vector.h:780:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::vector<long unsigned int>::size_type {aka long unsigned int}’
/usr/include/c++/6/bits/stl_vector.h:795:7: note: candidate: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>; std::vector<_Tp, _Alloc>::const_reference = const long unsigned int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]
       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
       ^~~~~~~~
/usr/include/c++/6/bits/stl_vector.h:795:7: note:   no known conversion for argument 1 from ‘std::__tuple_element_t<0ul, std::tuple<std::tuple<long int, long int>, long unsigned int, long unsigned int, long unsigned int> > {aka std::tuple<long int, long int>}’ to ‘std::vector<long unsigned int>::size_type {aka long unsigned int}’
stdout
Standard output is empty