結果

問題 No.781 円周上の格子点の数え上げ
ユーザー むらためむらため
提出日時 2019-01-17 08:51:38
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 885 bytes
コンパイル時間 928 ms
コンパイル使用メモリ 63,808 KB
最終ジャッジ日時 2023-09-13 22:38:01
合計ジャッジ時間 1,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 28) Error: cannot open file: queues

ソースコード

diff #

import sequtils,strutils,algorithm,math,sugar,macros,strformat
import sets,tables,intsets,queues,heapqueue,bitops
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `arr`;())
  for i in 0..<cnt: result[1].add(quote do:`t`[`i`])
template times*(n:int,body) = (for _ in 0..<n: body)
proc toCountSeq[T](x:seq[T]) : seq[tuple[k:T,v:int]] = toSeq(x.toCountTable().pairs)
template `max=`*(x,y) = x = max(x,y)
template `min=`*(x,y) = x = min(x,y)
proc sqrt(x:int):int = x.float.sqrt.int

let (x,y) = get().split().map(parseInt).unpack(2)
var results : array[1000_0010,int]
for a in 0..1000_0000.sqrt:
  for b in a..1000_0000.sqrt:
    var c = a * a + b * b
    if c > 1000_0000: break
    results[c] += (if a == 0 or a == b: 4 else: 8)

var ans = 0
for r in x..y: ans .max= results[r]
echo ans
0