結果
| 問題 |
No.832 麻雀修行中
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2022-01-24 02:45:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 1,060 bytes |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 11,136 KB |
| 最終ジャッジ日時 | 2024-11-30 11:39:26 |
| 合計ジャッジ時間 | 2,063 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 25 |
ソースコード
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)
elif check(copy.deepcopy(a)):
print(i + 1)
a[i] -= 1
YamaKasa