結果
| 問題 |
No.760 Where am I moved to?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-22 08:07:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
J_TLE
(最初)
|
| 実行時間 | - |
| コード長 | 2,012 bytes |
| コンパイル時間 | 1,608 ms |
| コンパイル使用メモリ | 173,604 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-25 10:06:37 |
| 合計ジャッジ時間 | 8,533 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 9 |
ソースコード
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
const double EPS = 1e-9;
using Vec = vector<double>;
using Matrix = vector<Vec>;
Vec GaussJordan(Matrix &A) {
int n = (int)A.size();
for (int i = 0; i < n; ++i) {
int pivot = i;
for (int j = i + 1; j < n; ++j)
if (abs(A[j][i])>abs(A[pivot][i])) pivot = j;
swap(A[i], A[pivot]);
if (abs(A[i][i]) < EPS && abs(A[i][n]) > EPS)
return Vec();
for (int j = n; j >= i; --j)A[i][j] /= A[i][i];
for (int j = 0; j < n; ++j)if (j != i)
for (int k = n; k >= i; --k)A[j][k] -= A[i][k] * A[j][i];
}
Vec res(n);
for (int i = 0; i < n; ++i)res[i] = A[i][n];
return res;
}
void solve() {
double xa, ya, ta, x[2][2], y[2][2], co, si;
cin >> xa >> ya >> ta;
rep(i, 2)rep(j, 2)cin >> x[i][j] >> y[i][j];
double xx = x[0][0] - x[0][1], yy = y[0][0] - y[0][1];
double XX = x[1][0] - x[1][1], YY = y[1][0] - y[1][1];
Matrix A(2, Vec(3));
A[0][0] = A[1][1] = xx;
A[0][1] = -yy;
A[1][0] = yy;
A[0][2] = XX;
A[1][2] = YY;
auto gd = GaussJordan(A);
co = gd[0], si = gd[1];
double p = x[1][0] - x[0][0] * co + y[0][0] * si;
double q = y[1][0] - x[0][0] * si - y[0][0] * co;
double t = ta + acos(co) / M_PI * 180;
cout << xa - p << ' ' << ya - q << ' ' << t << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << fixed << setprecision(15);
solve();
return 0;
}