제출 #1226787

#제출 시각아이디문제언어결과실행 시간메모리
1226787repsakRectangles (IOI19_rect)C++20
37 / 100
5094 ms22852 KiB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

long long count_rectangles(vector<vector<int> > a) {
	int height = a.size();
	int width = a[0].size();

	ll amount = 0;
	for(int y = 1; y < height - 1; y++){
		for(int x = 1; x < width - 1; x++){


			for(int by = y; by < height - 1; by++)
			{
				for(int bx = x; bx < width - 1; bx++)
				{

					bool isPossible = true;

					for(int i = y; i < by + 1; i++){
						for(int j = x; j < bx + 1; j++){
							int cell = a[i][j];
							if(
								cell >= a[i][x - 1] ||
								cell >= a[i][bx + 1] ||
								cell >= a[y - 1][j] ||
								cell >= a[by + 1][j]
							){
								isPossible = false;
								break;
							}
						}

						if(!isPossible) break;
					}

					if(isPossible){
						amount++;
					}
				}
			}
		}
	}
	return amount;
}

// #include "grader.cpp"
#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...