結果

問題 No.349 干支の置き物
ユーザー toshiro_yanagi
提出日時 2018-06-11 15:38:28
言語 Nim
(2.2.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 399 bytes
コンパイル時間 3,942 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 13:33:02
合計ジャッジ時間 4,979 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 24 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, tables
proc readLine: auto = readLine stdin

var dic = initCountTable[string]()
let N = readLine().parseInt

for i in 0 ..< N:
  dic.inc readLine()


while dic.largest.val != 1:
  let dic_L = dic.largest
  dic[dic_L.key] = 0

  if $dic != "{}":
    dic[dic.largest.key] = dic.largest.val - 1
  else:
    echo "NO"
    quit()

  dic[dic_L.key] = dic_L.val - 1


echo "YES"
0