結果

問題 No.832 麻雀修行中
ユーザー vwxyzvwxyz
提出日時 2024-04-07 22:12:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 796 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,916 KB
最終ジャッジ日時 2024-04-07 22:13:20
合計ジャッジ時間 22,075 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 412 ms
16,916 KB
testcase_01 AC 394 ms
10,112 KB
testcase_02 AC 476 ms
10,112 KB
testcase_03 AC 323 ms
10,112 KB
testcase_04 AC 867 ms
10,112 KB
testcase_05 AC 863 ms
10,112 KB
testcase_06 AC 640 ms
10,112 KB
testcase_07 AC 921 ms
10,112 KB
testcase_08 AC 844 ms
10,112 KB
testcase_09 AC 330 ms
10,112 KB
testcase_10 AC 1,078 ms
10,112 KB
testcase_11 AC 270 ms
10,112 KB
testcase_12 AC 366 ms
10,112 KB
testcase_13 AC 363 ms
10,112 KB
testcase_14 AC 442 ms
10,112 KB
testcase_15 AC 1,416 ms
10,112 KB
testcase_16 AC 242 ms
10,112 KB
testcase_17 AC 391 ms
10,112 KB
testcase_18 AC 478 ms
10,112 KB
testcase_19 AC 611 ms
10,112 KB
testcase_20 AC 904 ms
10,112 KB
testcase_21 AC 772 ms
10,112 KB
testcase_22 AC 512 ms
10,112 KB
testcase_23 AC 210 ms
10,112 KB
testcase_24 AC 950 ms
10,112 KB
testcase_25 AC 1,330 ms
10,112 KB
testcase_26 AC 512 ms
10,112 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

def check(A):
    N=len(A)
    if N==0:
        return True
    if N==3:
        A=sorted(A)
        return {b-a for a,b in zip(A,A[1:])} in ({0},{1})
    if N==14:
        for i in range(N):
            for j in range(i+1,N):
                if A[i]==A[j] and check([A[k] for k in range(N) if not k in (i,j)]):
                    return True
        A=sorted(A)
        if all(a==b for a,b in zip(A[::2],A[1::2])) and len(set(A))==7:
            return True
    else:
        for tpl in itertools.combinations(range(N),3):
            if check([A[i] for i in tpl]) and check([A[k] for k in range(N) if not k in tpl]):
                return True
    return False
S=[int(s) for s in input()]
for ans in range(1,10):
    if check(S+[ans]) and S.count(ans)<=3:
        print(ans)
0