結果

問題 No.832 麻雀修行中
ユーザー Kiri8128Kiri8128
提出日時 2020-12-10 00:49:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 789 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,080 KB
実行使用メモリ 10,184 KB
最終ジャッジ日時 2023-10-19 11:05:17
合計ジャッジ時間 2,706 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,184 KB
testcase_01 AC 30 ms
10,184 KB
testcase_02 AC 30 ms
10,184 KB
testcase_03 AC 31 ms
10,184 KB
testcase_04 AC 33 ms
10,184 KB
testcase_05 AC 32 ms
10,184 KB
testcase_06 AC 29 ms
10,184 KB
testcase_07 AC 29 ms
10,184 KB
testcase_08 AC 30 ms
10,184 KB
testcase_09 AC 29 ms
10,184 KB
testcase_10 AC 30 ms
10,184 KB
testcase_11 AC 29 ms
10,184 KB
testcase_12 AC 30 ms
10,184 KB
testcase_13 AC 30 ms
10,184 KB
testcase_14 AC 30 ms
10,184 KB
testcase_15 AC 30 ms
10,184 KB
testcase_16 AC 30 ms
10,184 KB
testcase_17 AC 31 ms
10,184 KB
testcase_18 AC 30 ms
10,184 KB
testcase_19 AC 30 ms
10,184 KB
testcase_20 AC 30 ms
10,184 KB
testcase_21 AC 30 ms
10,184 KB
testcase_22 AC 31 ms
10,184 KB
testcase_23 AC 30 ms
10,184 KB
testcase_24 AC 30 ms
10,184 KB
testcase_25 AC 30 ms
10,184 KB
testcase_26 AC 30 ms
10,184 KB
testcase_27 AC 31 ms
10,184 KB
testcase_28 AC 31 ms
10,184 KB
testcase_29 AC 30 ms
10,184 KB
testcase_30 AC 30 ms
10,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

X = [0] * 9
for a in input():
    X[int(a) - 1] += 1

def check_tempai(Y):
    RE = []
    for i in range(9):
        if Y[i] < 4 and check([a + 1 if i == j else a for j, a in enumerate(Y)]):
            RE.append(i + 1)
    return RE

def check(Y):
    for i in range(9):
        if Y[i] >= 2 and check_no_head([a - 2 if i == j else a for j, a in enumerate(Y)]):
            return 1
    if Y.count(2) == 7: return 1
    return 0
    
def check_no_head(Y):
    for i in range(9):
        if Y[i] >= 3:
            Y[i] -= 3
        if Y[i]:
            if i < 7 and Y[i+1] >= Y[i] and Y[i+2] >= Y[i]:
                Y[i+1] -= Y[i]
                Y[i+2] -= Y[i]
                Y[i] = 0
            else:
                return 0
    return 1

print("\n".join(map(str, check_tempai(X))))
0