結果
問題 |
No.2946 Puyo
|
ユーザー |
![]() |
提出日時 | 2024-11-02 15:16:26 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1,187 ms / 2,000 ms |
コード長 | 819 bytes |
コンパイル時間 | 11,441 ms |
コンパイル使用メモリ | 238,988 KB |
実行使用メモリ | 39,788 KB |
最終ジャッジ日時 | 2024-11-02 15:17:06 |
合計ジャッジ時間 | 38,365 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 |
ソースコード
package main import . "fmt" func main() { var h,w int Scan(&h,&w) f:=make([][]byte,h) m:=make([][]int,h) for i:=range f { var s string Scan(&s) f[i]=[]byte(s) m[i]=make([]int,w) } v:=0 t:=make([]int,h*w+1) for r,rr:=range f { for c,cc := range rr { if m[r][c]!=0 { continue } v++ st:=[]int{r*w+c} for len(st)>0 { e:=st[len(st)-1] st=st[:len(st)-1] x,y:=e%w,e/w if f[y][x]!=cc { continue } if m[y][x]!=0 { continue } m[y][x]=v t[v]++ if y>0 { st=append(st,e-w) } if y+1<h { st=append(st,e+w) } if x>0 { st=append(st,e-1) } if x+1<w { st=append(st,e+1) } } } } for r,rr:=range f { for c:=range rr { if t[m[r][c]]>=4 { f[r][c]='.' } } Println(string(rr)) } }