結果
問題 | No.1226 I hate Robot Arms |
ユーザー | uni_python |
提出日時 | 2020-09-13 00:31:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,185 ms / 2,000 ms |
コード長 | 2,659 bytes |
コンパイル時間 | 1,002 ms |
コンパイル使用メモリ | 86,856 KB |
実行使用メモリ | 198,260 KB |
最終ジャッジ日時 | 2023-08-30 19:40:57 |
合計ジャッジ時間 | 30,711 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,872 KB |
testcase_01 | AC | 78 ms
71,748 KB |
testcase_02 | AC | 575 ms
103,024 KB |
testcase_03 | AC | 595 ms
113,524 KB |
testcase_04 | AC | 668 ms
150,440 KB |
testcase_05 | AC | 633 ms
149,012 KB |
testcase_06 | AC | 1,125 ms
191,888 KB |
testcase_07 | AC | 494 ms
103,000 KB |
testcase_08 | AC | 372 ms
125,492 KB |
testcase_09 | AC | 785 ms
128,568 KB |
testcase_10 | AC | 308 ms
88,048 KB |
testcase_11 | AC | 734 ms
152,692 KB |
testcase_12 | AC | 499 ms
116,540 KB |
testcase_13 | AC | 434 ms
135,792 KB |
testcase_14 | AC | 916 ms
140,512 KB |
testcase_15 | AC | 313 ms
124,092 KB |
testcase_16 | AC | 1,176 ms
194,624 KB |
testcase_17 | AC | 502 ms
108,152 KB |
testcase_18 | AC | 403 ms
104,292 KB |
testcase_19 | AC | 736 ms
154,868 KB |
testcase_20 | AC | 677 ms
151,000 KB |
testcase_21 | AC | 840 ms
160,304 KB |
testcase_22 | AC | 1,141 ms
196,696 KB |
testcase_23 | AC | 1,148 ms
198,056 KB |
testcase_24 | AC | 1,185 ms
195,240 KB |
testcase_25 | AC | 1,162 ms
198,260 KB |
testcase_26 | AC | 1,099 ms
197,320 KB |
testcase_27 | AC | 1,002 ms
180,996 KB |
testcase_28 | AC | 996 ms
181,972 KB |
testcase_29 | AC | 991 ms
181,372 KB |
ソースコード
import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): from math import sin,cos,pi PI=pi class Segtree: def __init__(self, A, ide_ele, initialize = True, segf = max): self.N = len(A) self.N0 = 2**(self.N-1).bit_length() self.ide_ele = ide_ele self.segf = segf if initialize: self.data = [ide_ele]*self.N0 + A + [ide_ele]*(self.N0 - self.N) for i in range(self.N0-1, 0, -1): self.data[i] = self.segf(self.data[2*i], self.data[2*i+1]) else: self.data = [ide_ele]*(2*self.N0) def update(self, k, x): k += self.N0 self.data[k] = x while k > 0 : k = k >> 1 self.data[k] = self.segf(self.data[2*k], self.data[2*k+1]) def query(self, l, r): L, R = l+self.N0, r+self.N0 s = self.ide_ele t = self.ide_ele while L < R: if L & 1: s = self.segf(s,self.data[L]) L += 1 if R & 1: R -= 1 t = self.segf(self.data[R],t) L >>= 1 R >>= 1 return self.segf(s,t) def ch(X): return (X*PI)/180 def func(a,b): [x1,y1],t1 = a [x2,y2],t2 = b x=x1 + x2*cos(t1) - y2*sin(t1) y=y1 + x2*sin(t1) + y2*cos(t1) th=(t1+t2) # print("a:",a," b:",b) # print([[x,y],th*180/PI]) return [[x,y],th] N,Q=MI() A=[[[1,0],0]for _ in range(N)] seg=Segtree(A, [[0,0],0], segf=func) ds=[1]*N ths=[0]*N for _ in range(Q): q=LI() if q[0]==0: i=q[1]-1 th=ch(q[2]) ths[i]=th dn=ds[i] v=[dn*cos(th),dn*sin(th)] seg.update(i,[v,th]) elif q[0]==1: i=q[1]-1 d=q[2] ds[i]=d thn=ths[i] v=[d*cos(thn), d*sin(thn)] seg.update(i,[v,thn]) else: # print("++++++++++++++") i=q[1]-1 vn,tn=seg.query(0,i+1) # print("++++",i,*vn,tn*180/PI,"++++") print(*vn) # for i in range(N): # vn,thn=seg.query(i,i+1) # print(vn,thn*180/PI) main()