Submission #1047765

#TimeUsernameProblemLanguageResultExecution timeMemory
1047765Kel_MahmutRectangles (IOI19_rect)C++14
Compilation error
0 ms0 KiB
#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;
}

Compilation message (stderr)

rect.cpp: In function 'll count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:16:33: error: 'ok' was not declared in this scope; did you mean 'k'?
   16 |     for(int l = j; l < m - 1 && ok; l++){
      |                                 ^~
      |                                 k