結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー むらためむらため
提出日時 2018-12-16 03:19:20
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,112 bytes
コンパイル時間 3,301 ms
コンパイル使用メモリ 71,416 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 21:25:16
合計ジャッジ時間 4,651 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 45) Warning: imported and not used: 'math' [UnusedImport]
/home/judge/data/code/Main.nim(1, 50) Warning: imported and not used: 'sugar' [UnusedImport]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'strscans' [UnusedImport]
/home/judge/data/code/Main.nim(1, 35) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,strscans,algorithm,math,sugar,macros
#import sets,queues,tables,nre,pegs
macro unpack*(rhs: seq,cnt: static[int]): auto =
  let t = genSym(); result = quote do:(let `t` = `rhs`;())
  for i in 0..<cnt: result[1].add(quote do:`t`[`i`])
template get*():string = stdin.readLine() #.strip()
template times*(n:int,body:untyped): untyped = (for _ in 0..<n: body)
template `max=`*(x,y:typed):void = x = max(x,y)
template `min=`*(x,y:typed):void = x = min(x,y)

type Vec2 = object
  x,y: int
proc `+`(p,v:Vec2):Vec2 = result.x = p.x+v.x; result.y = p.y+v.y
proc `-`(p,v:Vec2):Vec2 = result.x = p.x-v.x; result.y = p.y-v.y
proc `*`(p,v:Vec2):int = p.x * v.x + p.y * v.y
proc sqlen(p:Vec2):int = p.x * p.x + p.y * p.y


let
  (x1,y1,x2,y2,x3,y3) = get().split().map(parseInt).unpack(6)
  z = @[(x1,y1),(x2,y2),(x3,y3),(x1,y1)].mapIt(Vec2(x:it[0],y:it[1]))
for i in 0..<3:
  let
    z1 = z[(i+0) mod 3]
    z2 = z[(i+1) mod 3]
    z3 = z[(i+2) mod 3]
    z12 = z2 - z1
    z13 = z3 - z1
  if z12 * z13 == 0 and z12.sqlen == z13.sqlen:
    let z4 = z3 + z12
    echo z4.x," ",z4.y
    quit()
echo -1
0