結果
問題 | No.697 池の数はいくつか |
ユーザー | ああいい |
提出日時 | 2022-03-07 20:00:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 86,760 KB |
実行使用メモリ | 168,208 KB |
最終ジャッジ日時 | 2023-09-29 21:13:55 |
合計ジャッジ時間 | 10,398 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,140 KB |
testcase_01 | WA | - |
testcase_02 | AC | 68 ms
71,140 KB |
testcase_03 | AC | 68 ms
71,252 KB |
testcase_04 | WA | - |
testcase_05 | AC | 69 ms
71,116 KB |
testcase_06 | AC | 68 ms
71,240 KB |
testcase_07 | WA | - |
testcase_08 | AC | 70 ms
71,140 KB |
testcase_09 | AC | 70 ms
71,292 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 69 ms
71,316 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 69 ms
71,144 KB |
testcase_16 | AC | 69 ms
71,144 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 70 ms
71,140 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 688 ms
168,160 KB |
testcase_30 | WA | - |
testcase_31 | AC | 707 ms
168,120 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
ソースコード
H,W = map(int,input().split()) A = [list(map(int,input().split())) for _ in range(H)] count = 2 stack = [] for h in range(H): for w in range(W): if A[h][w] == 0:continue if A[h][w] == 1: A[h][w] = count count += 1 if h + 1 < H and A[h+1][w] == 1: A[h+1][w] = A[h][w] if w + 1 < W and A[h][w+1] == 1: A[h][w+1] = A[h][w] print(count-2)