0026 - Dropping Ink

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;

int graph[10][10];

void Init(void)	{
	for (int i=0; i<10; ++i)
		for (int j=0; j<10; ++j)
		graph[i][j]=0;
}

void Slove(int x, int y, int size)	{
	const int dx[12]={1, 0, -1, 0, 1, -1, -1, 1, 2, 0, -2, 0}, dy[12]={0, 1, 0, -1, 1, 1, -1, -1, 0, 2, 0, -2};

	++graph[y][x];
	for (int k=0; k<size*4; ++k)
		if (0<=x+dx[k] && x+dx[k]<10 && 0<=y+dy[k] && y+dy[k]<10)	++graph[ y+dy[k] ][ x+dx[k] ];
}

int main(void)	{
	int x, y, size, no_color_count=0, max_deep=0;

	Init();
	while (scanf ("%d,%d,%d", &x, &y, &size) != EOF)
		Slove(x,y,size);
	for (int i=0; i<10; ++i)
		for (int j=0; j<10; ++j)	{
			if ( !graph[i][j] )	++no_color_count;
			max_deep=max(max_deep,graph[i][j]);
		}
	cout << no_color_count << endl << max_deep << endl;
	return 0;
}

基本やるだけ。