Submission #2106056
Source Code Expand
H,W=gets.split.map &:to_i N=gets.to_i a=gets.split.map &:to_i c=Array.new(H+2){Array.new(W+2){0}} (H+2).times{|i| c[i][0]=c[i][-1]=-1} (W+2).times{|j| c[0][j]=c[-1][j]=-1} dy=[1,0,-1,0] dx=[0,1,0,-1] d=0 n=1 y,x=0,1 until a.empty? ny=y+dy[d%4] nx=x+dx[d%4] next d+=1 if c[ny][nx]!=0 y=ny x=nx c[y][x]=n a[0]-=1 if a[0].zero? n+=1 a.shift end end puts c[1..H].map{|i|i[1..W]*" "}
Submission Info
Submission Time | |
---|---|
Task | D - Grid Coloring |
User | chabo |
Language | Ruby (2.3.3) |
Score | 400 |
Code Size | 436 Byte |
Status | AC |
Exec Time | 40 ms |
Memory | 2428 KB |
Compile Error
./Main.rb:1: warning: `&' interpreted as argument prefix ./Main.rb:3: warning: `&' interpreted as argument prefix
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 7 ms | 1788 KB |
0_01.txt | AC | 7 ms | 1788 KB |
0_02.txt | AC | 7 ms | 1788 KB |
1_00.txt | AC | 7 ms | 1788 KB |
1_01.txt | AC | 7 ms | 1788 KB |
1_02.txt | AC | 7 ms | 1788 KB |
1_03.txt | AC | 15 ms | 2044 KB |
1_04.txt | AC | 22 ms | 2300 KB |
1_05.txt | AC | 40 ms | 2428 KB |
1_06.txt | AC | 14 ms | 1916 KB |
1_07.txt | AC | 7 ms | 1788 KB |
1_08.txt | AC | 7 ms | 1788 KB |
1_09.txt | AC | 8 ms | 1788 KB |
1_10.txt | AC | 7 ms | 1788 KB |
1_11.txt | AC | 7 ms | 1788 KB |
1_12.txt | AC | 7 ms | 1788 KB |
1_13.txt | AC | 34 ms | 2428 KB |
1_14.txt | AC | 7 ms | 1788 KB |
1_15.txt | AC | 8 ms | 1788 KB |
1_16.txt | AC | 7 ms | 1788 KB |
1_17.txt | AC | 14 ms | 1916 KB |
1_18.txt | AC | 8 ms | 1788 KB |
1_19.txt | AC | 8 ms | 1788 KB |
1_20.txt | AC | 7 ms | 1788 KB |
1_21.txt | AC | 7 ms | 1788 KB |