結果

問題 No.1041 直線大学
ユーザー ikd
提出日時 2020-05-01 21:41:55
言語 Nim
(2.2.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 3,934 ms
コンパイル使用メモリ 64,640 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 07:51:52
合計ジャッジ時間 4,488 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils

let read = iterator: string {.closure.} =
  while true:
    for s in stdin.readLine.split:
      yield s

proc main() =
  let n = read().parseInt
  type P = tuple[x, y: int]
  var pts = newSeq[P]()
  for i in 0..<n:
    let x, y = read().parseInt
    pts.add((x, y))

  var ans = 0
  for p in pts:
    for q in pts:
      var cnt = 2
      if p == q:
        continue
      for r in pts:
        if p == r or q == r:
          continue
        if (r.y - p.y) * (r.x - q.x) == (r.y - q.y) * (r.x - p.x):
          cnt += 1
      ans = max(ans, cnt)
  echo ans
main()
0