Submission #481658

#TimeUsernameProblemLanguageResultExecution timeMemory
481658SlavicGQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include"quality.h" #include "bits/stdc++.h" using namespace std; #define ll long long #define forn(i,n) for(int i=0;i<n;i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(),v.rend() #define pb push_back #define sz(a) (int)a.size() const int N = 3001; int rectangle(int n, int m, int a, int b, int c[3001][3001]){ int ans = INT_MAX; for(int i = 0;i + a - 1 < n;++i){ for(int j = 0;j + b - 1 < m;++j){ int l = 1, r = n * m; while(l <= r){ int mid = l + r >> 1; int cnt_smaller = 0, cnt_greater = 0; for(int x = i;x < i + a;++x){ for(int y = j;y < j + b;++y){ if(c[x][y] < mid)++cnt_smaller; else if(c[x][y] > mid)++cnt_greater; } } if(cnt_smaller == cnt_greater){ ans = min(ans, c); r = mid - 1; }else if(cnt_smaller > cnt_greater){ r = mid - 1; }else l = mid + 1; } } } return ans; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:21:29: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   21 |                 int mid = l + r >> 1;
      |                           ~~^~~
quality.cpp:32:37: error: no matching function for call to 'min(int&, int (*&)[3001])'
   32 |                     ans = min(ans, c);
      |                                     ^
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 quality.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:
quality.cpp:32:37: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'int (*)[3001]')
   32 |                     ans = min(ans, c);
      |                                     ^
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 quality.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:
quality.cpp:32:37: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'int (*)[3001]')
   32 |                     ans = min(ans, c);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from quality.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:
quality.cpp:32:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |                     ans = min(ans, c);
      |                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from quality.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:
quality.cpp:32:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   32 |                     ans = min(ans, c);
      |                                     ^