# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047765 | Kel_Mahmut | Rectangles (IOI19_rect) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "rect.h"
#include <bits/stdc++.h>
#define pb push_back
#define endl ("\n")
#define all(aa) aa.begin(), aa.end()
typedef long long ll;
using namespace std;
ll count_rectangles(vector<vector<int>> a){
int n = a.size(), m = a[0].size();
ll ans = 0;
for(int i = 1; i < n - 1; i++){
for(int j = 1; j < m - 1; j++){
for(int k = i; k < n - 1; k++){
for(int l = j; l < m - 1 && ok; l++){
int ok = 1;
for(int I = i; I <= k && ok; I++){
for(int J = j; J <= l && ok; J++){
int ch = a[i-1][J];
ch = min(ch, a[k+1][J]);
ch = min(ch, a[I][j - 1]);
ch = min(ch, a[I][l + 1]);
if(a[I][J] >= ch)
ok = 0;
}
}
ans += ok;
}
}
}
}
return ans;
}