結果
問題 | No.832 麻雀修行中 |
ユーザー |
![]() |
提出日時 | 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,strutilsvarcnt : array[1..9 , int]s = stdin.readlineproc bfs(atama : bool, mentu : int, A : array[1..9, int]) : bool =if atama and mentu == 4:return truevar f : boolvar titoi = 0for i,a in A:if a > 4:return falseif a == 2:titoi += 1if titoi == 7:return truefor 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 = Afor j in 0..2:A2[i + j] -= 1f = bfs(atama, mentu + 1, A2)if f:return fif a > 2:var A2 = AA2[i] -= 3f = bfs(atama, mentu + 1, A2)if f:return fif a > 1 and atama == false:var A2 = AA2[i] -= 2f = bfs(true, mentu, A2)if f:return freturn falsefor c in s:cnt[ord(c) - ord('0')] += 1for m in 1..9:var B = cntB[m] += 1if bfs(false, 0, B):echo m