結果
問題 | No.832 麻雀修行中 |
ユーザー |
![]() |
提出日時 | 2019-05-24 21:46:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 1,186 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-09-17 10:33:24 |
合計ジャッジ時間 | 2,414 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 25 |
ソースコード
from collections import defaultdict,dequeimport sys,heapq,bisect,math,itertools,string,queue,datetimesys.setrecursionlimit(10**8)INF = float('inf')mod = 10**9+7eps = 10**-7def inpl(): return list(map(int, input().split()))def inpl_str(): return list(input().split())S = list(map(int,list(input())))cnt = [0]*10ans = []for s in S:cnt[s] += 1# 七対子if cnt.count(2) == 6:ans.append(cnt.index(1))def dfs1 (te):a = te[0]if te.count(a) >= 3:for i in range(3):te.remove(a)if len(te) == 0:return Truereturn dfs1(te)elif (a+1 in te) and (a+2 in te):for i in range(3):te.remove(a+i)if len(te) == 0:return Truereturn dfs1(te)else:return Falsefor x in range(1,10):if cnt[x] >= 4:continuetmpS = S + [x]tmpS.sort()# 単騎待ちfor atama in range(1,10):if tmpS.count(atama) <= 1:continuenowS = tmpS[:]nowS.remove(atama)nowS.remove(atama)if dfs1(nowS):ans.append(x)ans = list(set(ans))ans.sort()for a in ans:print(a)