結果

問題 No.349 干支の置き物
ユーザー むらため
提出日時 2019-01-16 18:13:18
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 3,760 ms
コンパイル使用メモリ 73,580 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 06:30:24
合計ジャッジ時間 4,720 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 RE * 1
other WA * 28 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,algorithm,tables
let n = stdin.readLine().parseInt()
var B = toSeq(newSeqWith(n,stdin.readLine()).sorted(cmp).toCountTable().values).sorted(cmp)
while true:
  B = B.sorted(cmp)
  B[^1] -= 1
  B[^2] -= 1
  if B[^1] < 0 : quit "NO",0
  if B[^2] == 0 and B[^1] <= 1 : quit "YES",0
0