結果

問題 No.761 平均値ゲーム
コンテスト
ユーザー ikd
提出日時 2018-12-09 10:22:12
言語 Nim
(2.2.6)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 499 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,716 ms
コンパイル使用メモリ 70,304 KB
実行使用メモリ 24,644 KB
最終ジャッジ日時 2026-03-22 00:24:08
合計ジャッジ時間 7,518 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import strutils, sequtils

proc f(a: seq[int64], turn: bool): bool =
  let n = a.len
  if a.all(proc(x: int64): bool = a[0]==x):
    result = true
  else:
    let s = a.foldl(a+b)
    var j = 0
    while j<n and a[j]*n<s:
      j+=1
    let
      res1 = f(a[0..<j], not turn)
      res2 = f(a[j..<n], not turn)
    result = not (res1 and res2)

proc main() =
  let
    n = stdin.readLine.parseInt
    a = stdin.readLine.split.map(parseBiggestInt)
  echo if f(a, true): "First" else: "Second"
main()
0