Submission #1229009


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|
      next if i <= 1 || i >= H || j <= 1 || j >= W
      h[D * i + j] += 1 
    end
  end
end

c = h.values.inject(Array.new(10, 0)) {|a, v| a[v] += 1; a}
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 396 Byte
Status AC
Exec Time 808 ms
Memory 67068 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 501 ms 8828 KB
02.txt AC 723 ms 48764 KB
03.txt AC 138 ms 5372 KB
04.txt AC 7 ms 1788 KB
05.txt AC 452 ms 23292 KB
06.txt AC 497 ms 23420 KB
07.txt AC 808 ms 67068 KB
08.txt AC 798 ms 67068 KB
09.txt AC 807 ms 67068 KB
10.txt AC 7 ms 1788 KB
11.txt AC 707 ms 45820 KB
12.txt AC 796 ms 66812 KB
13.txt AC 9 ms 1788 KB
14.txt AC 796 ms 56060 KB
15.txt AC 717 ms 45948 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