結果

問題 No.832 麻雀修行中
ユーザー vwxyzvwxyz
提出日時 2024-04-07 22:13:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,208 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,252 KB
最終ジャッジ日時 2024-04-07 22:13:42
合計ジャッジ時間 12,319 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
77,336 KB
testcase_01 AC 275 ms
77,448 KB
testcase_02 AC 308 ms
78,108 KB
testcase_03 AC 195 ms
76,700 KB
testcase_04 AC 367 ms
77,576 KB
testcase_05 AC 368 ms
77,552 KB
testcase_06 AC 342 ms
78,472 KB
testcase_07 AC 400 ms
77,832 KB
testcase_08 AC 359 ms
77,444 KB
testcase_09 AC 236 ms
77,060 KB
testcase_10 AC 402 ms
77,192 KB
testcase_11 AC 202 ms
76,936 KB
testcase_12 AC 217 ms
76,808 KB
testcase_13 AC 229 ms
78,084 KB
testcase_14 AC 274 ms
77,576 KB
testcase_15 AC 506 ms
77,960 KB
testcase_16 AC 168 ms
76,804 KB
testcase_17 AC 228 ms
77,476 KB
testcase_18 AC 281 ms
77,064 KB
testcase_19 AC 327 ms
77,708 KB
testcase_20 AC 450 ms
78,856 KB
testcase_21 AC 411 ms
77,832 KB
testcase_22 AC 258 ms
76,932 KB
testcase_23 AC 174 ms
76,804 KB
testcase_24 AC 437 ms
78,344 KB
testcase_25 AC 599 ms
79,436 KB
testcase_26 AC 271 ms
77,192 KB
testcase_27 AC 1,208 ms
81,252 KB
testcase_28 AC 182 ms
76,676 KB
testcase_29 AC 182 ms
77,192 KB
testcase_30 AC 536 ms
78,624 KB
権限があれば一括ダウンロードができます

ソースコード

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