結果
| 問題 |
No.832 麻雀修行中
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2019-05-24 23:49:59 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,190 bytes |
| コンパイル時間 | 2,968 ms |
| コンパイル使用メモリ | 65,040 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 03:48:02 |
| 合計ジャッジ時間 | 3,982 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 25 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport]
ソースコード
import sequtils,strutils
var
cnt : array[1..9 , int]
s = stdin.readline
proc bfs(atama : bool, mentu : int, A : array[1..9, int]) : bool =
if atama and mentu == 4:
return true
var f : bool
var titoi = 0
for i,a in A:
if a > 4:
return false
if a == 2:
titoi += 1
if titoi == 7:
return true
for i,a in A:
if a > 0:
if i <= 7 and a > 0 and A[i + 1] > 0 and A[i + 2] > 0:
var A2 = A
for j in 0..2:
A2[i + j] -= 1
f = bfs(atama, mentu + 1, A2)
if f:
return f
if a > 2:
var A2 = A
A2[i] -= 3
f = bfs(atama, mentu + 1, A2)
if f:
return f
if a > 1 and atama == false:
var A2 = A
A2[i] -= 2
f = bfs(true, mentu, A2)
if f:
return f
return false
for c in s:
cnt[ord(c) - ord('0')] += 1
for m in 1..9:
var B = cnt
B[m] += 1
if bfs(false, 0, B):
echo m
6soukiti29