結果
| 問題 | 
                            No.832 麻雀修行中
                             | 
                    
| コンテスト | |
| ユーザー | 
                             YamaKasa
                         | 
                    
| 提出日時 | 2022-01-24 02:34:16 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,075 bytes | 
| コンパイル時間 | 161 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-11-30 11:18:05 | 
| 合計ジャッジ時間 | 2,502 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 23 WA * 2 | 
ソースコード
import copy
a = [0] * 9
s = list(map(int,input()))
for i in s:
    a[i - 1] += 1
def seven_pairs(a):
    cnt = 0
    for i in range(9):
        if a[i] == 2: cnt += 1
    return cnt == 7
def can_decomp(p):
    cnt = 0
    for i in range(9):
        if p[i] >= 3:
            cnt += 1
            p[i] -= 3
        if i < 7:
            if p[i] >= 2 and p[i+1] >= 2 and p[i+2] >= 2:
                cnt += 2
                p[i] -= 2
                p[i + 1] -= 2
                p[i + 2] -= 2
            elif p[i] >= 1 and p[i+1] >= 1 and p[i+2] >= 1:
                cnt += 1
                p[i] -= 1
                p[i + 1] -= 1
                p[i + 2] -= 1
    return cnt == 4
def check(p):
    for i in range(9):
        if p[i] >= 2:
            p[i] -= 2
            if can_decomp(copy.deepcopy(p)):
                return True
            p[i] += 2
    return False
for i in range(9):
    if a[i] == 4: continue
    a[i] += 1
    if seven_pairs(a):
        print(i + 1)
        continue
    if check(copy.deepcopy(a)):
        print(i + 1)
    a[i] -= 1
            
            
            
        
            
YamaKasa