Submission #232420

#TimeUsernameProblemLanguageResultExecution timeMemory
232420crossing0ver삶의 질 (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "quality.h" using namespace std; const int N = 9E5 + 5; int median; int t[4*N]; int pos,numb,ans = INT_MAX,i,F; void upd (int v = 1,int tl = 1,int tr = numb) { if (tl == tr) { if (t[v]) t[v] = 0; else t[v] = 1; return; } int tm = (tl +tr)/2; if (pos <= tm) upd (v*2,tl,tm); else upd (v*2|1,tm+1,tr); t[v] = t[v*2] + t[v*2 + 1]; } int get (int v = 1, int tl = 1, int tr = numb) { if (tl == tr) return tl; int tm = (tl + tr)/2; // if (F <= t[v*2+1]) return get(v*2 + 1,tm + 1,tr,F); // F -= t[v*2 + 1]; // return get(v*2,tl,tm,F); if (F <= t[v*2]) return get(v*2,tl,tm,F); F -= t[v*2]; return get(v*2|1,tm+1,tr,F); } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { numb = R*C; median = (H*W+1)/2; for (i = 0; i < H; i++) for (int j = 0; j < W; j++) { pos = Q[i][j]; upd(); } // ans = get(); // cout << ans; // exit(0); int r = W - 1, l = 0, h = 0, d = H - 1; int dir = 0; // 0 - r 1 - d 2 - l while (true) { F = median; ans = min(ans,get()); if (!dir) { if (r != C - 1) { for (i = h; i <= d; i++) { pos = Q[i][l]; upd(); pos = Q[i][r + 1]; upd(); } r++; l++; } else if (d != R - 1){ dir = 1; for (i = l; i <=r ; i++) { pos = Q[h][i]; upd(); pos = Q[d + 1][i]; upd(); } h++; d++; } else break; } else if (dir == 1) { if (l != 0) { dir = 2; for (i = h; i <= d; i++) { pos = Q[i][r]; upd(); pos = Q[i][l-1]; upd(); } r--; l--; } else if (r != C - 1) { dir = 0; for (i = h; i <= d; i++) { pos = Q[i][l]; upd(); pos = Q[i][r + 1]; upd(); } r++; l++; } else if (d != R - 1) { for (i = l; i <=r ; i++) { pos = Q[h][i]; upd(); pos = Q[d + 1][i]; upd(); } h++; d++; } else break; } else { if (l != 0) { for (i = h; i <= d; i++) { pos = Q[i][r]; upd(); pos = Q[i][l-1]; upd(); } r--; l--; } else if (d != R - 1) { dir = 1; for (i = l; i <=r ; i++) { pos = Q[h][i]; upd(); pos = Q[d + 1][i]; upd(); } h++; d++; } else break; } } return ans; //return R*C/2; } //static int R,C,H,W,Q[3001][3001],i,j,ans; /* int main(){ static int R,C,H,W,Q[3001][3001] = {},i,j; scanf("%d%d%d%d",&R,&C,&H,&W); for (i=0;i<R;i++) for (j=0;j<C;j++) scanf("%d",&Q[i][j]); // ans = rectangle(R,C,H,W,Q); printf("%d\n",ans); return 0; } */

Compilation message (stderr)

quality.cpp: In function 'int get(int, int, int)':
quality.cpp:28:41: error: no matching function for call to 'get(int, int&, int&, int&)'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
quality.cpp:21:5: note: candidate: int get(int, int, int)
 int get (int v = 1, int tl = 1, int tr = numb) {
     ^~~
quality.cpp:21:5: note:   candidate expects 3 arguments, 4 provided
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1361:5: note: candidate: template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1361:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1355:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Types...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1355:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1349:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1349:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1326:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1320:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1314:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:324:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/include/c++/7/array:316:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:307:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:273:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_Up, _Tp>&&)
     get(pair<_Up, _Tp>&& __p) noexcept
     ^~~
/usr/include/c++/7/utility:273:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:268:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_Up, _Tp>&)
     get(const pair<_Up, _Tp>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:268:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::pair<_Up, _Tp>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:263:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_Up, _Tp>&)
     get(pair<_Up, _Tp>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:263:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_Up, _Tp>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:258:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp&& std::get(std::pair<_T1, _T2>&&)
     get(pair<_Tp, _Up>&& __p) noexcept
     ^~~
/usr/include/c++/7/utility:258:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:253:5: note: candidate: template<class _Tp, class _Up> constexpr const _Tp& std::get(const std::pair<_T1, _T2>&)
     get(const pair<_Tp, _Up>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:253:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:248:5: note: candidate: template<class _Tp, class _Up> constexpr _Tp& std::get(std::pair<_T1, _T2>&)
     get(pair<_Tp, _Up>& __p) noexcept
     ^~~
/usr/include/c++/7/utility:248:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_T1, _T2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:239:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const std::pair<_Tp1, _Tp2>&)
     get(const std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/include/c++/7/utility:239:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'const std::pair<_Tp1, _Tp2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:234:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(std::pair<_Tp1, _Tp2>&&)
     get(std::pair<_Tp1, _Tp2>&& __in) noexcept
     ^~~
/usr/include/c++/7/utility:234:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
In file included from /usr/include/c++/7/algorithm:60:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from quality.cpp:1:
/usr/include/c++/7/utility:229:5: note: candidate: template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(std::pair<_Tp1, _Tp2>&)
     get(std::pair<_Tp1, _Tp2>& __in) noexcept
     ^~~
/usr/include/c++/7/utility:229:5: note:   template argument deduction/substitution failed:
quality.cpp:28:41: note:   mismatched types 'std::pair<_Tp1, _Tp2>' and 'int'
  if (F <= t[v*2]) return get(v*2,tl,tm,F);
                                         ^
quality.cpp:30:28: error: no matching function for call to 'get(int, int, int&, int&)'
  return get(v*2|1,tm+1,tr,F);
                            ^
quality.cpp:21:5: note: candidate: int get(int, int, int)
 int get (int v = 1, int tl = 1, int tr = numb) {
     ^~~
quality.cpp:21:5: note:   candidate expects 3 arguments, 4 provided
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1361:5: note: candidate: template<class _Tp, class ... _Types> constexpr const _Tp& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1361:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1355:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Types...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1355:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1349:5: note: candidate: template<class _Tp, class ... _Types> constexpr _Tp& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Types...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1349:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1326:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(std::tuple<_Elements ...>&&)
     get(tuple<_Elements...>&& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1326:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1320:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const std::tuple<_Elements ...>&)
     get(const tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1320:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'const std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/functional:54:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/tuple:1314:5: note: candidate: template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(std::tuple<_Elements ...>&)
     get(tuple<_Elements...>& __t) noexcept
     ^~~
/usr/include/c++/7/tuple:1314:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'std::tuple<_Elements ...>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:324:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const std::array<_Tp, _Nm>&)
     get(const array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:324:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'const std::array<_Tp, _Nm>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:316:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(std::array<_Tp, _Nm>&&)
     get(array<_Tp, _Nm>&& __arr) noexcept
     ^~~
/usr/include/c++/7/array:316:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   mismatched types 'std::array<_Tp, _Nm>' and 'int'
  return get(v*2|1,tm+1,tr,F);
                            ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/functional:54,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71,
                 from quality.cpp:1:
/usr/include/c++/7/array:307:5: note: candidate: template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(std::array<_Tp, _Nm>&)
     get(array<_Tp, _Nm>& __arr) noexcept
     ^~~
/usr/include/c++/7/array:307:5: note:   template argument deduction/substitution failed:
quality.cpp:30:28: note:   misma