結果
問題 | No.1226 I hate Robot Arms |
ユーザー | π |
提出日時 | 2020-09-21 02:01:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,705 bytes |
コンパイル時間 | 2,119 ms |
コンパイル使用メモリ | 206,500 KB |
実行使用メモリ | 14,456 KB |
最終ジャッジ日時 | 2024-06-24 11:19:31 |
合計ジャッジ時間 | 13,428 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,884 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 337 ms
6,940 KB |
testcase_03 | AC | 718 ms
6,944 KB |
testcase_04 | TLE | - |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double dbl; typedef long double ld; #define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i) #define REP(i, b) FOR(i, 0, b) #define FORLL(i, a, b) for(ll i = (ll)(a); i < (ll)(b); ++i) #define REPLL(i, b) FORLL(i, 0, b) #define ALL(x) (x).begin(),(x).end() const int INF = 1e+9; constexpr int mod(int n) {return n % 1000000007;} template<class Head, class... Tail> inline Head max(Head head, Tail... tail) {for(Head i: initializer_list<Head>{tail...}) if(head < i) head = i; return head;} template<class Head, class... Tail> inline Head min(Head head, Tail... tail) {for(Head i: initializer_list<Head>{tail...}) if(head > i) head = i; return head;} template<class T, class... U> inline void chmax(T &v, U... a) {v = ::max(v, a...);} template<class T, class... U> inline void chmin(T &v, U... a) {v = ::min(v, a...);} inline void read(char &v) {v = getchar();} inline void read(int &v) {assert(scanf("%d", &v));} inline void read(ll &v) {assert(scanf("%lld", &v));} inline void read(ull &v) {assert(scanf("%llu", &v));} inline void read(dbl &v) {assert(scanf("%lf", &v));} inline void read(ld &v) {assert(scanf("%Lf", &v));} inline void read(string &v){v.clear(); char buf[512]; do read(*buf); while(*buf == ' ' || *buf == '\n'); for(int pt = 1;;) {read(buf[pt]); if(buf[pt] == ' ' || buf[pt] == '\n') {v.append(buf, pt); break;} if(++pt >= 512) {v.append(buf, 512); pt = 0;}}} template<class T> inline void read(vector<T> &v) {int N = v.size(); REP(i, N) read(v[i]);} template<class T, size_t N> inline void read(array<T, N> &v) {REP(i, N) read(v[i]);} template<class Head, class... Tail> inline void read(Head &head, Tail &... tail) {read(head); read(tail...);} bool write_space = false; inline void write() {if(write_space) putchar(' '); else write_space = true;} inline void write(char v) {if(v == '\n' || v == ' ') write_space = false; else write(); putchar(v);} inline void write(const char *v){if(!*v) {write(); return;} if(*v != '\n' && *v != ' ') write(); while(*v) putchar(*(v++)); --v; write_space = *v != '\n' && *v != ' ';} inline void write(string &v){write(v.c_str());} inline void write(int v) {write(); printf("%d", v);} inline void write(ll v) {write(); printf("%lld", v);} inline void write(ull v) {write(); printf("%llu", v);} inline void write(dbl v) {write(); printf("%.16f", v);} inline void write(ld v) {write(); printf("%.32Lf", v);} template<class T> inline void write(vector<T> &v) {int N = size(v); REP(i, N) write(v[i]); write('\n');} template<class T, size_t N> inline void write(array<T, N> &v) {REP(i, N) write(v[i]); write('\n');} template<class Head, class... Tail> inline void write(Head head, Tail... tail) {write(head); write(tail...);} ld cos_p[360]; void tri() { const ld pi_180 = 3.141592653589793238462643383279502884L / 180; REP(i, 360) { cos_p[i] = cosl(pi_180 * i); } } int main() { tri(); int n, q, u = 1; vector<int> arm, joint; vector<array<ld, 2>> pt; vector<int> deg; read(n, q); arm.resize(n); REP(i, n) arm[i] = 1; joint.resize(n); pt.resize(n + 1); deg.resize(n + 1); REP(count, q) { int a, i; read(a, i); switch(a) { case 0: read(joint[i - 1]); if(u > i) u = i; break; case 1: read(arm[i - 1]); if(u > i) u = i; break; case 2: for(;u <= i;u++) { deg[u] = (deg[u - 1] + joint[u - 1]) % 360; pt[u][0] = pt[u - 1][0] + cos_p[deg[u]] * arm[u - 1]; pt[u][1] = pt[u - 1][1] + cos_p[(deg[u] + 270) % 360] * arm[u - 1]; } write(pt[i][0], pt[i][1], '\n'); } } return 0; }