結果
| 問題 |
No.2708 Jewel holder
|
| ユーザー |
ID 21712
|
| 提出日時 | 2024-11-08 22:23:32 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 579 bytes |
| コンパイル時間 | 13,865 ms |
| コンパイル使用メモリ | 226,240 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 22:23:48 |
| 合計ジャッジ時間 | 14,899 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
package main
import . "fmt"
func main() {
var h,w int
Scan(&h,&w)
f:=make([][]byte,h)
for i:=range f {
var s string
Scan(&s)
f[i]=[]byte(s)
}
ps:=[]int{0,0,1}
var ans int
for len(ps)>0 {
n:=len(ps)-3
x,y,c:=ps[n],ps[n+1],ps[n+2]
ps=ps[:n]
if x+1<w{
if e:=f[y][x+1];e=='o' {
ps=append(ps,x+1,y,c+1)
} else if e=='x'&&c>0 {
ps=append(ps,x+1,y,c-1)
}
}
if y+1<h {
if e:=f[y+1][x];e=='o' {
ps=append(ps,x,y+1,c+1)
} else if e=='x'&&c>0 {
ps=append(ps,x,y+1,c-1)
}
}
if x+1==w&&y+1==h {
ans++
}
}
Println(ans)
}
ID 21712