[BOJ] 10163 색종이

Time Lapse : 5min 2sec

10163.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
int p[102][102];
int a[101];
int main(int argc, char** argv) {
int N, answer = 0, x, y, dx, dy;
scanf("%d", &N);
for (int i = 1; i <= N; i++) {
scanf("%d %d %d %d", &y, &x, &dy, &dx);
for (int _x = x; _x < x + dx; _x++)
for (int _y = y; _y < y + dy; _y++)
p[_y][_x] = i;
}
for (int i = 0; i <= 101; i++)
for (int j = 0; j <= 101; j++)
a[p[i][j]]++;
for (int i = 1; i <= N; i++)
printf("%d\n", a[i]);
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/23/PS/BOJ/10163/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.