Submission #1180484
Source Code Expand
using System; using System.Collections.Generic; namespace ABC045Coloring { class Program { static void Main(string[] args) { ulong H, W; int N; string[] vals = Console.ReadLine().Split(' '); H = ulong.Parse(vals[0]); W = ulong.Parse(vals[1]); N = int.Parse(vals[2]); ulong[,] ab; if (N >= 1) ab = new ulong[N, 2]; else ab = new ulong[1, 2]; for(int i=0; i < N; i++) { vals = Console.ReadLine().Split(' '); ab[i, 0] = ulong.Parse(vals[0]); ab[i, 1] = ulong.Parse(vals[1]); } ulong[] totalCount = new ulong[10]; totalCount[0] = (W - 2) * (H - 2); Dictionary<ulong, int> count = new Dictionary<ulong, int>(); for(int i=0; i < N; i++) { ulong a, b; ulong n; for(uint y=0; y < 3; y++) { for(uint x=0; x < 3; x++) { a = ab[i, 0] - y; b = ab[i, 1] - x; if (a < 1 || a > H - 2 || b < 1 || b > W - 2) continue; n = (a - 1) * (W - 2) + (b - 1); //Console.WriteLine("Square " + i + " is in (" + a + "," + b + ") n=" + n); if (count.ContainsKey(n)) { count[n]++; } else { totalCount[0]--; count[n] = 1; } } } } foreach(var n in count.Keys) { if(count[n] <= 9) totalCount[count[n]]++; } for (int i = 0; i <= 9; i++) Console.WriteLine(totalCount[i]); } } }
Submission Info
Submission Time | |
---|---|
Task | D - Snuke's Coloring |
User | hogeki |
Language | C# (Mono 4.6.2.0) |
Score | 400 |
Code Size | 2193 Byte |
Status | AC |
Exec Time | 299 ms |
Memory | 66960 KB |
Judge Result
Set Name | Sample | All | ||
---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||
Status | AC |
|
Set Name | Test Cases |
---|---|
Sample | |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, empty.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 175 ms | 21708 KB |
02.txt | AC | 223 ms | 43620 KB |
03.txt | AC | 65 ms | 21084 KB |
04.txt | AC | 23 ms | 11220 KB |
05.txt | AC | 162 ms | 33480 KB |
06.txt | AC | 160 ms | 33992 KB |
07.txt | AC | 288 ms | 65536 KB |
08.txt | AC | 297 ms | 66960 KB |
09.txt | AC | 299 ms | 63512 KB |
10.txt | AC | 24 ms | 13152 KB |
11.txt | AC | 235 ms | 43108 KB |
12.txt | AC | 284 ms | 63148 KB |
13.txt | AC | 24 ms | 11232 KB |
14.txt | AC | 290 ms | 59048 KB |
15.txt | AC | 263 ms | 46172 KB |
empty.txt | AC | 22 ms | 13140 KB |
sample_01.txt | AC | 23 ms | 9056 KB |
sample_02.txt | AC | 24 ms | 13152 KB |
sample_03.txt | AC | 22 ms | 13152 KB |