Submission #253567

#TimeUsernameProblemLanguageResultExecution timeMemory
253567ErkhemkhuuRectangles (IOI19_rect)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define F first #define S second const ll N = 5005; bool valid(ll x1, ll y1, ll x2, ll y2, vector <vector <ll> > &a) { for(ll i = x1; i <= x2; i++) { for(ll j = y1; j <= y2; j++) { if(a[i][j] >= a[x1 - 1][j]) return false; if(a[i][j] >= a[x2 + 1][j]) return false; if(a[i][j] >= a[i][y1 - 1]) return false; if(a[i][j] >= a[i][y2 + 1]) return false; } } return true; } ll count_rectangles(vector <vector <int> > a) { ll res, i, j, n, m, i1, j1; res = 0; n = a.size(); m = a[0].size(); for(i = 1; i < n - 1; i++) for(j = 1; j < m - 1; j++) for(i1 = i; i1 < n - 1; i1++) for(j1 = j; j1 < m - 1; j1++) res += valid(i, j, i1, j1, a); return res; }

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:28:49: error: invalid initialization of reference of type 'std::vector<std::vector<long long int> >&' from expression of type 'std::vector<std::vector<int> >'
                     res += valid(i, j, i1, j1, a);
                                                 ^
rect.cpp:9:6: note: in passing argument 5 of 'bool valid(long long int, long long int, long long int, long long int, std::vector<std::vector<long long int> >&)'
 bool valid(ll x1, ll y1, ll x2, ll y2, vector <vector <ll> > &a) {
      ^~~~~