結果
| 問題 |
No.675 ドットちゃんたち
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-03 22:27:53 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 1,319 bytes |
| コンパイル時間 | 2,845 ms |
| コンパイル使用メモリ | 76,048 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-01 11:17:55 |
| 合計ジャッジ時間 | 4,234 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(4, 1) Warning: template 'stopwatch' is implicitly redefined; this is deprecated, add an explicit .redefine pragma [ImplicitTemplateRedefinition] /home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import sequtils,times
proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
template stopwatch(body) = (let t1 = cpuTime();body;echo "TIME:",(cpuTime() - t1) * 1000,"ms")
template stopwatch(body) = body
# GC_disableMarkAndSweep()
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
var minus = false
block:
let k = getchar_unlocked()
if k == '-' : minus = true
else: result = 10 * result + k.ord - '0'.ord
while true:
let k = getchar_unlocked()
if k < '0' or k > '9': break
result = 10 * result + k.ord - '0'.ord
if minus: result *= -1
stopwatch:
let n = scan()
let px = scan()
let py = scan()
var Q,V,X,Y : array[100010,int]
for i in 0..<n:
Q[i] = scan()
if Q[i] == 3 : continue
V[i] = scan()
var M = @[@[1,0,0],@[0,1,0],@[0,0,1]]
stopwatch:
let p = @[px,py,1]
for i in (n-1).countdown(0):
let q = Q[i]
let v = V[i]
if q == 3:
for i in 0..<3:
(M[0][i],M[1][i]) = (-M[1][i],M[0][i])
elif q == 2:
for i in 0..<3:
M[2][i] += v * M[1][i]
else:
for i in 0..<3:
M[2][i] += v * M[0][i]
X[i] = M[0][0] * px + M[1][0] * py + M[2][0]
Y[i] = M[0][1] * px + M[1][1] * py + M[2][1]
stopwatch:
for i in 0..<n: printf("%d %d\n",X[i],Y[i])