제출 #380017

#제출 시각아이디문제언어결과실행 시간메모리
380017SuhaibSawalha1Rectangles (IOI19_rect)C++17
0 / 100
16 ms384 KiB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
 
long long count_rectangles(vector<vector<int>> a) {
	int n = a.size(), m = a[0].size();
	long long ans = 0;
	for (int x = 1; x < n - 1; ++x) {
		for (int y = 1; y < m - 1; ++y) {
			for (int i = x; i < n  - 1; ++i) {
				if (a[i][y] >= a[i][y - 1] || a[i][y] >= a[x - 1][y]) {
					break;
				}
				bool bad = 0;
				for (int j = y; j < m - 1 && !bad; ++j) {
					bool good = 1;
					for (int l = x; l <= i && good; ++l) {
						for (int r = y; r <= j && good; ++r) {
							good &= a[l][r] < a[l][j + 1] && a[l][r] < a[i + 1][r];
							bad |= !good && (a[l][r] >= a[l][y - 1] || a[l][r] >= a[x - 1][r] || a[l][r] >= a[l + 1][r]);
						}
					}
					if (bad) {
						break;
					}
					ans += good;
				}
			}
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...