Submission #1059876

# Submission time Handle Problem Language Result Execution time Memory
1059876 2024-08-15T08:51:12 Z Unforgettablepl Rectangles (IOI19_rect) C++17
13 / 100
479 ms 523844 KB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;

long long count_rectangles(vector<vector<int>> a){
	int n = a.size();
	int m = a[0].size();
	long long ans = 0;
	vector visited = a;
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			if(visited[i][j])continue;
			int minx = n;
			int maxx = 0;
			int miny = m;
			int maxy = 0;
			int area = 0;
			function<void(int,int)> dfs = [&](int x,int y) {
				if(visited[x][y])return;
				visited[x][y]=true;
				area++;
				minx=min(minx,x);
				maxx=max(maxx,x);
				miny=min(miny,y);
				maxy=max(maxy,y);
				if(x!=0)dfs(x-1,y);
				if(y!=0)dfs(x,y-1);
				if(x!=n-1)dfs(x+1,y);
				if(y!=m-1)dfs(x,y+1);
			};
			dfs(i,j);
			if(minx==0)continue;
			if(miny==0)continue;
			if(maxx==n-1)continue;
			if(maxy==m-1)continue;
			if((maxx-minx+1)*(maxy-miny+1)==area)ans++;
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 86 ms 39772 KB Output is correct
3 Correct 203 ms 85840 KB Output is correct
4 Correct 193 ms 86096 KB Output is correct
5 Correct 202 ms 86140 KB Output is correct
6 Correct 198 ms 183636 KB Output is correct
7 Correct 415 ms 440148 KB Output is correct
8 Correct 479 ms 523844 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -