Submission #1228975


Source Code Expand

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[[i, j]] += 1 
    end
  end
end

c = Array.new(10, 0)
h.each do |k, v|
  i, j = k 
  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 0
Code Size 386 Byte
Status TLE
Exec Time 3042 ms
Memory 106516 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status AC
AC × 18
TLE × 1
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 2916 ms 15484 KB
02.txt AC 2972 ms 87548 KB
03.txt AC 700 ms 8700 KB
04.txt AC 7 ms 1788 KB
05.txt AC 2932 ms 106492 KB
06.txt AC 2916 ms 106492 KB
07.txt AC 2956 ms 106516 KB
08.txt AC 2967 ms 106492 KB
09.txt AC 2970 ms 106492 KB
10.txt AC 7 ms 1788 KB
11.txt AC 2988 ms 83580 KB
12.txt AC 2968 ms 106108 KB
13.txt AC 18 ms 1788 KB
14.txt AC 2974 ms 94972 KB
15.txt TLE 3042 ms 83708 KB
empty.txt AC 7 ms 1788 KB
sample_01.txt AC 7 ms 1788 KB
sample_02.txt AC 8 ms 1788 KB
sample_03.txt AC 7 ms 1788 KB