Submission #1228993


Source Code Expand

D = 1_000_000_000
H, W, N = gets.split.map(&:to_i)

h = Hash.new(0)
N.times do
  a, b = gets.split.map(&:to_i)
  ((a - 1)..(a + 1)).each do |i|
    ((b - 1)..(b + 1)).each do |j|
      h[D * i + j] += 1 
    end
  end
end

c = Array.new(10, 0)
h.each do |k, v|
  i = k / D 
  j = k % D
  next if i <= 1 || i >= H || j <= 1 || j >= W 
  c[v] += 1 
end

c[0] = (H - 2) * (W - 2) - c.inject(:+)
puts c

Submission Info

Submission Time
Task D - Snuke's Coloring
User hatovalley
Language Ruby (2.3.3)
Score 400
Code Size 420 Byte
Status AC
Exec Time 961 ms
Memory 60028 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status AC
AC × 19
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 488 ms 8444 KB
02.txt AC 806 ms 44924 KB
03.txt AC 134 ms 5116 KB
04.txt AC 7 ms 1788 KB
05.txt AC 935 ms 60028 KB
06.txt AC 894 ms 60028 KB
07.txt AC 918 ms 60028 KB
08.txt AC 937 ms 60028 KB
09.txt AC 941 ms 60028 KB
10.txt AC 7 ms 1788 KB
11.txt AC 777 ms 41108 KB
12.txt AC 961 ms 59900 KB
13.txt AC 9 ms 1788 KB
14.txt AC 891 ms 50172 KB
15.txt AC 788 ms 41212 KB
empty.txt AC 7 ms 1788 KB
sample_01.txt AC 7 ms 1788 KB
sample_02.txt AC 7 ms 1788 KB
sample_03.txt AC 7 ms 1788 KB