結果

問題 No.202 1円玉投げ
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-05-06 21:51:04
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 855 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 57,252 KB
最終ジャッジ日時 2023-08-23 22:26:07
合計ジャッジ時間 2,177 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(21, 14) Error: type mismatch: got <int>
but expected one of:
proc `<`(x, y: int): bool
  first type mismatch at position: 2
  missing parameter: y
proc `<`(x, y: int64): bool
  first type mismatch at position: 2
  missing parameter: y
19 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: <n

ソースコード

diff #

import strutils, sequtils

const
  M = 20001
  LEN = 33
  CNT = M div LEN

type
  Point = tuple[x,y:int]

###
# (ΦωΦ)<もっといい方法はないかな?
proc mymapII(s:seq[string]):auto= result = (s[0].parseInt, s[1].parseInt)
###

var
  n = stdin.readLine.parseInt
  blocks:seq[seq[seq[Point]]] = newSeqWith(CNT+1, newSeqWith(CNT+1, newSeq[Point](0)))
  res = 0

for i in 0.. <n:
  var (x, y) = stdin.readLine.split.mymapII
  var px = x div LEN
  var py = y div LEN
  var ok = true
  for xx in -1..1:
    for yy in -1..1:
      var nx = px + xx
      var ny = py + yy
      if nx < 0 or CNT < nx or ny < 0 or CNT < ny: continue
      for p in blocks[nx][ny]:
        if (p.x-x)*(p.x-x) + (p.y-y)*(p.y-y) < 400:
          ok = false
          break
  if ok:
    res += 1
    var point:Point = (x: x, y: y)
    blocks[px][py].add(point)

echo res
0