結果
問題 |
No.1226 I hate Robot Arms
|
ユーザー |
![]() |
提出日時 | 2020-09-11 22:33:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,370 bytes |
コンパイル時間 | 2,325 ms |
コンパイル使用メモリ | 200,088 KB |
最終ジャッジ日時 | 2025-01-14 10:51:59 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 28 |
ソースコード
#include <stdio.h> #include <atcoder/segtree> #include <bits/stdc++.h> using namespace std; using namespace atcoder; #define rep(i,n) for (int i = 0; i < (n); ++i) #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000 double eps = 1e-9; struct Data{ double r=0.0,theta=0.0; double stheta = 0.0; }; Data op(Data a,Data b){ if(abs(b.r)<eps)return a; if(abs(a.r)<eps)return b; double x = a.r * cos(a.theta) + b.r * cos(b.theta+a.stheta); double y = a.r * sin(a.theta) + b.r * sin(b.theta+a.stheta); Data ret; ret.r = hypot(x,y); ret.theta = atan2(y,x); ret.stheta = a.stheta + b.stheta; return ret; } Data e(){ return Data(); } int main(){ int N,Q; cin>>N>>Q; Data temp = {1.0,0.0}; vector<Data> T(N+1,temp); T[0].r = 0.0; segtree<Data,op,e> seg(T); rep(_,Q){ int t; cin>>t; if(t==0){ int i,x; cin>>i>>x; Data D = seg.get(i); D.theta = (acos(-1.0)/180.0)*(double)x; D.stheta = D.theta; // cout<<D.theta<<endl; seg.set(i,D); } else if(t==1){ int i,x; cin>>i>>x; Data D = seg.get(i); D.r = (double)x; seg.set(i,D); } else{ int i; cin>>i; Data D = seg.prod(0,i+1); //cout<<D.theta<<endl; double x = D.r * cos(D.theta); double y = D.r * sin(D.theta); cout<<fixed<<setprecision(10)<<x<<' '<<y<<endl; } } return 0; }