Submission #2466320
Source Code Expand
package main
import (
"fmt"
)
func main() {
var h, w int
fmt.Scan(&h, &w)
s := make([]string, h)
for i := 0; i < h; i++ {
fmt.Scan(&s[i])
}
dx := []int{1, -1, 0, 0}
dy := []int{0, 0, 1, -1}
success := true
for y := 0; success && y < h; y++ {
for x := 0; success && x < w; x++ {
if s[y][x] == '#' {
tmp := false
for i := 0; i < 4; i++ {
nx := x + dx[i]
ny := y + dy[i]
if 0 <= nx && nx < w && 0 <= ny && ny < h && s[ny][nx] == '#' {
tmp = true
}
}
success = tmp
}
}
}
if success {
fmt.Println("Yes")
} else {
fmt.Println("No")
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Grid Repainting 2 |
| User | rankey55 |
| Language | Go (1.6) |
| Score | 300 |
| Code Size | 647 Byte |
| Status | AC |
| Exec Time | 3 ms |
| Memory | 512 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| in01.txt | AC | 2 ms | 512 KiB |
| in02.txt | AC | 2 ms | 512 KiB |
| in03.txt | AC | 2 ms | 512 KiB |
| in04.txt | AC | 2 ms | 512 KiB |
| in05.txt | AC | 3 ms | 512 KiB |
| in06.txt | AC | 2 ms | 512 KiB |
| in07.txt | AC | 2 ms | 512 KiB |
| in08.txt | AC | 2 ms | 512 KiB |
| in09.txt | AC | 2 ms | 512 KiB |
| in10.txt | AC | 2 ms | 512 KiB |
| sample_01.txt | AC | 1 ms | 512 KiB |
| sample_02.txt | AC | 1 ms | 512 KiB |
| sample_03.txt | AC | 1 ms | 512 KiB |