結果

問題 No.1932 動く点 P / Moving Point P
ユーザー RhoRho
提出日時 2020-03-23 12:43:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,392 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 181,120 KB
実行使用メモリ 10,960 KB
最終ジャッジ日時 2023-09-20 01:32:41
合計ジャッジ時間 22,490 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
10,960 KB
testcase_01 AC 2,412 ms
10,924 KB
testcase_02 AC 481 ms
10,744 KB
testcase_03 AC 1,154 ms
10,800 KB
testcase_04 AC 3,369 ms
10,716 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define MRE assert(0);
const int inf = 1e17;
const double pi = 3.1415926535897932;
const int mod = 998244353;
struct matrix {
	double dat[3][3];
	matrix() {
		rep(i, 3)rep(j, 3)dat[i][j] = 0;
		rep(i, 3)dat[i][i] = 1;
	}
	void init(double theta, double p, double q) {
		theta = theta*pi / 180.0;
		dat[0][0] = cos(theta);
		dat[0][1] = -sin(theta);
		dat[0][2] = q*sin(theta) - p*cos(theta) + p;
		dat[1][0] = sin(theta);
		dat[1][1] = cos(theta);
		dat[1][2] = -p*sin(theta) - q*cos(theta) + q;
	}
};
matrix mul(matrix M2, matrix M1) {
	matrix res;
	rep(i, 3)res.dat[i][i] = 0;
	rep(i, 3) {
		rep(j, 3) {
			rep(k, 3) {
				res.dat[i][j] += M1.dat[i][k] * M2.dat[k][j];
			}
		}
	}
	return res;
}
matrix M[100006];
signed main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n; cin >> n;
	rep(i, n) {
		double p, q, r; cin >> p >> q >> r;
		M[i].init(r, p, q);
	}
	int q; cin >> q;
	rep(j, q) {
		int s, t; double x, y; cin >> s >> t >> x >> y;
		double nx, ny;
		for (int i = s - 1; i < t; i++) {
			nx = M[i].dat[0][0] * x + M[i].dat[0][1] * y + M[i].dat[0][2];
			ny = M[i].dat[1][0] * x + M[i].dat[1][1] * y + M[i].dat[1][2];
			x = nx; y = ny;
		}
		printf("%.13lf %.13lf\n", x,y);
	}
}
0