結果
問題 | No.421 しろくろチョコレート |
ユーザー | ckawatak |
提出日時 | 2019-01-26 13:39:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,180 bytes |
コンパイル時間 | 282 ms |
コンパイル使用メモリ | 82,704 KB |
実行使用メモリ | 80,580 KB |
最終ジャッジ日時 | 2024-09-16 04:56:15 |
合計ジャッジ時間 | 5,509 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,228 KB |
testcase_01 | WA | - |
testcase_02 | AC | 56 ms
65,740 KB |
testcase_03 | WA | - |
testcase_04 | AC | 46 ms
61,188 KB |
testcase_05 | WA | - |
testcase_06 | AC | 39 ms
53,568 KB |
testcase_07 | WA | - |
testcase_08 | AC | 47 ms
61,852 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 36 ms
53,632 KB |
testcase_13 | AC | 38 ms
53,640 KB |
testcase_14 | AC | 37 ms
52,976 KB |
testcase_15 | AC | 38 ms
52,636 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 37 ms
53,256 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 36 ms
52,152 KB |
testcase_24 | AC | 38 ms
52,140 KB |
testcase_25 | AC | 36 ms
53,432 KB |
testcase_26 | AC | 37 ms
52,516 KB |
testcase_27 | AC | 36 ms
52,304 KB |
testcase_28 | AC | 55 ms
66,636 KB |
testcase_29 | AC | 59 ms
68,508 KB |
testcase_30 | WA | - |
testcase_31 | RE | - |
testcase_32 | AC | 53 ms
65,320 KB |
testcase_33 | WA | - |
testcase_34 | AC | 44 ms
60,368 KB |
testcase_35 | AC | 45 ms
60,500 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 54 ms
64,784 KB |
testcase_41 | AC | 42 ms
58,604 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 51 ms
63,940 KB |
testcase_45 | WA | - |
testcase_46 | AC | 42 ms
60,552 KB |
testcase_47 | WA | - |
testcase_48 | RE | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 54 ms
66,612 KB |
testcase_52 | WA | - |
testcase_53 | AC | 43 ms
60,416 KB |
testcase_54 | AC | 47 ms
61,136 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 | 37 ms
52,644 KB |
testcase_63 | AC | 35 ms
52,540 KB |
testcase_64 | AC | 40 ms
59,420 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)