結果

問題 No.216 FAC
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-04 03:12:11
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 389 bytes
コンパイル時間 3,632 ms
コンパイル使用メモリ 71,740 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 09:32:06
合計ジャッジ時間 4,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, tables, math
proc input: auto = stdin.readLine

let
  N = input().parseInt
  a, b = input().split.map parseInt
var
  left_points = a.sum
  competitors = initCountTable[int]()

for i, b in b:
  if b != 0:
    left_points -= a[i]
    for j in 0 ..< a[i]:
      competitors.inc(b)

for k, v in competitors:
  if v > left_points:
    echo "NO"
    quit()
echo "YES"
0