結果
| 問題 |
No.832 麻雀修行中
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2019-05-25 00:05:47 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,236 bytes |
| コンパイル時間 | 3,248 ms |
| コンパイル使用メモリ | 65,152 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 03:49:31 |
| 合計ジャッジ時間 | 4,217 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 dfs(atama : bool, mentu : int, A : array[1..9, int]) : bool =
var A = A
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:
for j in 0..2:
A[i + j] -= 1
f = dfs(atama, mentu + 1, A)
for j in 0..2:
A[i + j] += 1
if f:
return f
if a > 2:
A[i] -= 3
f = dfs(atama, mentu + 1, A)
A[i] -= 3
if f:
return f
if a > 1 and atama == false:
A[i] -= 2
f = dfs(true, mentu, A)
A[i] += 2
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 dfs(false, 0, B):
echo m
6soukiti29