結果
| 問題 |
No.233 めぐるはめぐる (3)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-26 20:46:52 |
| 言語 | Nim (2.2.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 812 bytes |
| コンパイル時間 | 3,358 ms |
| コンパイル使用メモリ | 69,940 KB |
| 実行使用メモリ | 17,844 KB |
| 最終ジャッジ日時 | 2024-07-01 10:59:50 |
| 合計ジャッジ時間 | 9,623 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 2 WA * 9 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(11, 12) Warning: Deprecated since v0.20, use 'initHashSet'; initSet is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import sequtils,algorithm,sets,strutils
template times*(n:int,body) = (for _ in 0..<n: body)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
while true:
let k = getchar_unlocked()
if k < '0': break
result = 10 * result + k.ord - '0'.ord
let n = scan()
var used = initSet[string]()
block:
var cache = "inabameguru"
n.times:
for i in 0..<cache.len: cache[i] = getchar_unlocked()
used.incl cache
discard getchar_unlocked()
var S = "inabameguru".sorted(cmp).join("")
proc impl() =
const consonant = ['n','b','m','g','r']
if S[^1] in consonant : return
for i in 1..<S.len:
if S[i] in consonant and S[i-1] in consonant: return
if S notin used: quit S, 0
while true:
impl()
if not S.nextPermutation(): break
echo "NO"