結果
| 問題 |
No.697 池の数はいくつか
|
| ユーザー |
Mr.Fuku
|
| 提出日時 | 2018-06-23 21:07:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 459 bytes |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 81,920 KB |
| 最終ジャッジ日時 | 2024-11-25 13:50:55 |
| 合計ジャッジ時間 | 20,340 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 RE * 2 |
ソースコード
h,w = input().split()
h,w = int(h),int(w)
lst = []
cnt = 0
def tansaku(x,y):
if lst[x][y]=="0":
return
lst[x][y]="0"
tansaku(x+1,y)
tansaku(x-1,y)
tansaku(x,y+1)
tansaku(x,y-1)
for a in range(h):
lst.append(["0"]+input().split()+["0"])
lst.insert(0,["0"]*(w+2))
lst.append(["0"]*(w+2))
for a in range(1,h+1):
for b in range(1,w+1):
if lst[a][b]=="1":
cnt+=1
tansaku(a,b)
print(cnt)
Mr.Fuku