Submission #54407583
Source Code Expand
N = gets.to_i
L = 3**N
S = Array.new(L){ [?#]*L<<"\n" }.flatten
Ln = L+1
F = lambda{|i,l|
if 3<=l
l /= 3
c = i+l*(1+Ln)
c.step(c+l*Ln-1,Ln){|i|
S.fill ?.,i...i+l
}
[0,1,1,Ln,Ln,-1,-1,-Ln].each{|di|
F[i+=di*l,l]
}
end
}
F[0,L]
puts S*''
Submission Info
| Submission Time | |
|---|---|
| Task | C - Sierpinski carpet |
| User | ds14050 |
| Language | Ruby (ruby 3.2.2) |
| Score | 250 |
| Code Size | 276 Byte |
| Status | AC |
| Exec Time | 138 ms |
| Memory | 30792 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 250 / 250 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 118 ms | 17092 KiB |
| example_01.txt | AC | 46 ms | 17168 KiB |
| test_00.txt | AC | 54 ms | 19188 KiB |
| test_01.txt | AC | 44 ms | 17132 KiB |
| test_02.txt | AC | 45 ms | 17620 KiB |
| test_03.txt | AC | 44 ms | 17176 KiB |
| test_04.txt | AC | 45 ms | 17448 KiB |
| test_05.txt | AC | 138 ms | 30792 KiB |
| test_06.txt | AC | 45 ms | 17500 KiB |