結果
問題 | No.421 しろくろチョコレート |
ユーザー | ckawatak |
提出日時 | 2019-01-26 13:39:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,180 bytes |
コンパイル時間 | 366 ms |
コンパイル使用メモリ | 87,256 KB |
実行使用メモリ | 101,896 KB |
最終ジャッジ日時 | 2023-10-14 09:59:05 |
合計ジャッジ時間 | 9,539 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
71,232 KB |
testcase_01 | WA | - |
testcase_02 | AC | 90 ms
76,624 KB |
testcase_03 | WA | - |
testcase_04 | AC | 83 ms
76,116 KB |
testcase_05 | WA | - |
testcase_06 | AC | 72 ms
71,244 KB |
testcase_07 | WA | - |
testcase_08 | AC | 83 ms
76,156 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 72 ms
71,456 KB |
testcase_13 | AC | 72 ms
71,304 KB |
testcase_14 | AC | 74 ms
71,124 KB |
testcase_15 | AC | 73 ms
71,492 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 72 ms
71,264 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 73 ms
71,308 KB |
testcase_24 | AC | 74 ms
71,220 KB |
testcase_25 | AC | 73 ms
71,308 KB |
testcase_26 | AC | 72 ms
71,260 KB |
testcase_27 | AC | 72 ms
71,212 KB |
testcase_28 | AC | 91 ms
76,864 KB |
testcase_29 | AC | 96 ms
77,032 KB |
testcase_30 | WA | - |
testcase_31 | RE | - |
testcase_32 | AC | 89 ms
76,736 KB |
testcase_33 | WA | - |
testcase_34 | AC | 80 ms
75,980 KB |
testcase_35 | AC | 81 ms
76,092 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | RE | - |
testcase_39 | WA | - |
testcase_40 | AC | 90 ms
77,112 KB |
testcase_41 | AC | 78 ms
75,832 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 91 ms
77,048 KB |
testcase_45 | WA | - |
testcase_46 | AC | 79 ms
75,832 KB |
testcase_47 | WA | - |
testcase_48 | RE | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 91 ms
77,388 KB |
testcase_52 | WA | - |
testcase_53 | AC | 80 ms
76,132 KB |
testcase_54 | AC | 84 ms
76,068 KB |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | RE | - |
testcase_61 | RE | - |
testcase_62 | AC | 74 ms
71,416 KB |
testcase_63 | AC | 74 ms
71,232 KB |
testcase_64 | AC | 78 ms
76,000 KB |
ソースコード
N,M = list(map(int, input().split(' '))) C = [] for _ in range(N): blocks = input() choco = [] for block in blocks: choco.append(block) C.append(choco) W = 0 B = 0 DX = [0, -1, 0, 1] DY = [-1, 0, 1, 0] def dfs(x,y): global W global B if C[x][y] == 'w': W = W + 1 elif C[x][y] == 'b': B = B + 1 C[x][y] = '.' for i in range(len(DX)): nx = x + DX[i] ny = y + DY[i] if 0 <= nx and nx < N and 0 <= ny and ny < M \ and (C[nx][ny] == 'w' or C[nx][ny] == 'b'): dfs(nx,ny) wbs = [] for i in range(N): for j in range(M): if C[i][j] != '.': W = 0 B = 0 dfs(i,j) wbs.append([W,B]) rows = 0 for wb in wbs: while 0 < wb[0] and 0 < wb[1]: wb[0] = wb[0] - 1 wb[1] = wb[1] - 1 rows = rows + 1 total_w = 0 total_b = 0 for wb in wbs: total_w = total_w + wb[0] total_b = total_b + wb[1] pairs = 0 while 0 < total_w and 0 < total_b: total_w = total_w - 1 total_b = total_b - 1 pairs = pairs + 1 print(rows * 100 + pairs * 10 + total_w + total_b)