結果

問題 No.832 麻雀修行中
ユーザー kohei2019kohei2019
提出日時 2022-04-21 23:20:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 454 ms / 2,000 ms
コード長 4,449 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 82,016 KB
最終ジャッジ日時 2023-09-05 05:46:21
合計ジャッジ時間 14,613 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 346 ms
80,376 KB
testcase_01 AC 325 ms
79,344 KB
testcase_02 AC 218 ms
78,328 KB
testcase_03 AC 229 ms
78,668 KB
testcase_04 AC 392 ms
80,352 KB
testcase_05 AC 317 ms
79,408 KB
testcase_06 AC 302 ms
79,508 KB
testcase_07 AC 366 ms
79,412 KB
testcase_08 AC 380 ms
81,676 KB
testcase_09 AC 285 ms
79,716 KB
testcase_10 AC 304 ms
78,496 KB
testcase_11 AC 250 ms
78,816 KB
testcase_12 AC 297 ms
79,324 KB
testcase_13 AC 326 ms
80,272 KB
testcase_14 AC 312 ms
79,460 KB
testcase_15 AC 434 ms
82,016 KB
testcase_16 AC 310 ms
80,452 KB
testcase_17 AC 272 ms
79,144 KB
testcase_18 AC 330 ms
79,736 KB
testcase_19 AC 341 ms
79,632 KB
testcase_20 AC 339 ms
79,124 KB
testcase_21 AC 420 ms
80,480 KB
testcase_22 AC 276 ms
79,320 KB
testcase_23 AC 238 ms
78,984 KB
testcase_24 AC 331 ms
79,668 KB
testcase_25 AC 394 ms
80,320 KB
testcase_26 AC 359 ms
80,196 KB
testcase_27 AC 454 ms
80,304 KB
testcase_28 AC 286 ms
79,672 KB
testcase_29 AC 234 ms
79,604 KB
testcase_30 AC 434 ms
80,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
S = list(map(int,list(input())))
def ok3(ll):
    if ll[0] == ll[1] == ll[2]:
        return True
    ll.sort()
    if (ll[0]+2) == (ll[1]+1) and (ll[1]+1) == (ll[2]):
        return True
    return False
def okall(lll):
    S1 = lll[:]
    for j in range(13):
        for k in range(j+1,14):
            if S1[j] == S1[k]:
                S2 = S1[:]
                S2.pop(j)
                S2.pop(k-1)
                for x in range(10):
                    for y in range(x+1,11):
                        for z in range(y+1,12):
                            if ok3([S2[x],S2[y],S2[z]]):
                                S3 = S2[:]
                                S3.pop(x)
                                S3.pop(y-1)
                                S3.pop(z-2)
                                for x1 in range(7):
                                    for y1 in range(x1+1,8):
                                        for z1 in range(y1+1,9):
                                            if ok3([S3[x1],S3[y1],S3[z1]]):
                                                S4 = S3[:]
                                                S4.pop(x1)
                                                S4.pop(y1-1)
                                                S4.pop(z1-2)
                                                for x2 in range(4):
                                                    for y2 in range(x2+1,5):
                                                        for z2 in range(y2+1,6):
                                                            if ok3([S4[x2],S4[y2],S4[z2]]):
                                                                S5 = S4[:]
                                                                S5.pop(x2)
                                                                S5.pop(y2-1)
                                                                S5.pop(z2-2)
                                                                if ok3([S5[0],S5[1],S5[2]]):
                                                                    return True
                if max(collections.Counter(S1).values()) == 4:
                    continue
                for x in range(11):
                    for y in range(x+1,12):
                        if S2[x] == S2[y]:
                            S3 = S2[:]
                            S3.pop(x)
                            S3.pop(y-1)
                            for x1 in range(9):
                                for y1 in range(x1+1,10):
                                    if S3[x1] == S3[y1]:
                                        S4 = S3[:]
                                        S4.pop(x1)
                                        S4.pop(y1-1)
                                        for x2 in range(7):
                                            for y2 in range(x2+1,8):
                                                if S4[x2] == S4[y2]:
                                                    S5 = S4[:]
                                                    S5.pop(x2)
                                                    S5.pop(y2-1)
                                                    for x3 in range(5):
                                                        for y3 in range(x3+1,6):
                                                            if S5[x3] == S5[y3]:
                                                                S6 = S5[:]
                                                                S6.pop(x3)
                                                                S6.pop(y3-1)
                                                                for x4 in range(3):
                                                                    for y4 in range(x4+1,4):
                                                                        if S6[x4] == S6[y4]:
                                                                            S7 = S6[:]
                                                                            S7.pop(x4)
                                                                            S7.pop(y4-1)
                                                                            if S7[0] == S7[1]:
                                                                                return True
    return False

for i in range(1,10):
    S0 = S+[i]
    if max(collections.Counter(S0).values()) > 4:
        continue
    if okall(S0):
        print(i)

0