#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int dy[4] = {0,-1,1,0};
int dx[4] = {-1,0,0,1};
int visited[101][101] = {0,};
vector<int> v;
int arr[101][101] = {0,};
int cnt = 0;
int n,m,k;
void blook_count(int i,int j){
for (int b = 0;b < 4;b++) {
int nx = i+dx[b];
int ny = j+dy[b];
if (0<=ny && m > ny && 0<=nx && n > nx) {
if(visited[i][j] == 0 && arr[i][j] == 0){
cnt++;
blook_count(nx,ny);
// cout << cnt << "\n";
}
}
}
}
int main() {
cin >> n >> m >> k;
for (int b = 0;b < k;b++) {
int x,y,x2,y2;
cin >> x >> y >> x2 >> y2;
for (int i = x2;i < x;i++) {
for (int j = y;j < y2;j++) {
arr[i][j] = 1;
}
}
}
for (int i = 0;i < n;i++) {
for (int j = 0;j < m;j++) {
cnt = 0;
cout <<arr[i][j]<<"\n";
if (arr[i][j] == 0) {
cout << "!!!!!!!!!!!!" << "\n";
blook_count(i,j);
}
if (cnt != 0) {
v.push_back(cnt);
}
}
}
sort(v.begin(),v.end());
//cout << v.size() << "\n";
for (int i = 0;i < v.size();i++) {
//cout << v[i] << " ";
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: