제출 #147452

#제출 시각아이디문제언어결과실행 시간메모리
147452mosiashvililukaRectangles (IOI19_rect)C++14
37 / 100
5035 ms84124 KiB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[2509][2509],z,x,pas;
bool dp[202][202][202],dp2[202][202][202];
long long count_rectangles(vector <vector <int> > A){
	a=A.size();
	b=A[0].size();
	a--;b--;
	for(c=0; c<=a; c++) for(d=0; d<=b; d++) f[c][d]=A[c][d];
	if(a==2){
		for(c=1; c<b; c++){
		z=0;
		for(d=c; d<b; d++){
			if(z<f[1][d]) z=f[1][d];
			if(z>=f[1][c-1]||f[1][d]>=f[0][d]||f[1][d]>=f[2][d]) break;
			if(z<f[1][d+1]) pas++;
		}
	}
	return pas;
	}
	for(c=1; c<a; c++){
		for(d=1; d<b; d++){
			z=0;
			for(e=d; e<b; e++){
				if(z<f[c][e]) z=f[c][e];
				if(z>=f[c][d-1]) break;
				if(z<f[c][e+1]){
					dp[c][d][e]=1;
				}
			}
		}
	}
	for(c=1; c<a; c++){
		for(d=1; d<b; d++){
			z=0;
			for(e=c; e<a; e++){
				if(z<f[e][d]) z=f[e][d];
				if(z>=f[c-1][d]) break;
				if(z<f[e+1][d]) dp2[c][d][e]=1;
			}
		}
	}
//	cout<<dp[2][1][1]<<endl;
	for(c=1; c<a; c++){
		for(d=1; d<b; d++){
			for(e=c; e<a; e++){
				for(z=d; z<b; z++){
					bool bo=0;
					for(x=c; x<=e; x++){
						if(dp[x][d][z]==0){
							bo=1;break;
						}
					}
					if(bo==0){
						for(x=d; x<=z; x++){
							if(dp2[c][x][e]==0){
								bo=1;break;
							}
						}
						if(bo==0) pas++;
					}
				}
			}
		}
	}
	return pas;
}
#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...