結果
問題 | No.832 麻雀修行中 |
ユーザー | bellangeldindon |
提出日時 | 2019-04-25 15:46:52 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 1,397 bytes |
コンパイル時間 | 563 ms |
コンパイル使用メモリ | 6,784 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-05-02 22:30:42 |
合計ジャッジ時間 | 2,310 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 14 ms
6,016 KB |
testcase_01 | AC | 15 ms
6,144 KB |
testcase_02 | AC | 15 ms
6,144 KB |
testcase_03 | AC | 17 ms
6,144 KB |
testcase_04 | AC | 15 ms
6,144 KB |
testcase_05 | AC | 15 ms
6,144 KB |
testcase_06 | AC | 14 ms
6,144 KB |
testcase_07 | AC | 15 ms
6,016 KB |
testcase_08 | AC | 15 ms
6,144 KB |
testcase_09 | AC | 14 ms
6,016 KB |
testcase_10 | AC | 15 ms
6,144 KB |
testcase_11 | AC | 16 ms
6,016 KB |
testcase_12 | AC | 16 ms
6,144 KB |
testcase_13 | AC | 13 ms
6,144 KB |
testcase_14 | AC | 15 ms
6,144 KB |
testcase_15 | AC | 14 ms
6,016 KB |
testcase_16 | AC | 13 ms
6,144 KB |
testcase_17 | AC | 13 ms
6,144 KB |
testcase_18 | AC | 13 ms
6,144 KB |
testcase_19 | AC | 16 ms
6,144 KB |
testcase_20 | AC | 14 ms
6,144 KB |
testcase_21 | AC | 16 ms
6,144 KB |
testcase_22 | AC | 13 ms
6,144 KB |
testcase_23 | AC | 14 ms
6,144 KB |
testcase_24 | AC | 14 ms
6,016 KB |
testcase_25 | AC | 14 ms
6,144 KB |
testcase_26 | AC | 13 ms
6,144 KB |
testcase_27 | AC | 15 ms
6,016 KB |
testcase_28 | AC | 12 ms
6,016 KB |
testcase_29 | AC | 17 ms
6,144 KB |
testcase_30 | AC | 14 ms
6,016 KB |
ソースコード
def judge(tile): cnt = 0 for i in range(0, 9): if tile[i] > 4: return False for i in range(0, 9): if tile[i] == 2: cnt += 1 if cnt == 7: return True pair = [] for i in range(0, 9): if tile[i] >= 2: pair.append(i) queue = [] for i in range(0, len(pair)): newtile = [] for j in range(0, 9): if j == pair[i]: newtile.append(tile[j]-2) else: newtile.append(tile[j]) queue.append(newtile) while(queue != []): now = queue.pop(0) flag = True for i in range(0, 9): if now[i] != 0: flag = False break if flag: return True for i in range(0, 9): if now[i] >= 3: nexttile = [] for j in range(0, 9): if j == i: nexttile.append(now[j]-3) else: nexttile.append(now[j]) if now != nexttile and nexttile not in queue: queue.append(nexttile) if i < 7: if now[i] >= 1 and now[i+1] >= 1 and now[i+2] >= 1: nexttile = [] for j in range(0, 9): if i <= j and j <= i+2: nexttile.append(now[j]-1) else: nexttile.append(now[j]) if now != nexttile and nexttile not in queue: queue.append(nexttile) return False S = raw_input() tiles = [] for i in range(0, 9): tiles.append(0) for i in range(0, 13): n = int(S[i]) tiles[n-1] += 1 for i in range(0, 9): newtiles = [] for j in range(0, 9): if i == j: newtiles.append(tiles[j]+1) else: newtiles.append(tiles[j]) if judge(newtiles): print i+1