結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
![]() |
提出日時 | 2014-11-03 00:46:00 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,239 bytes |
コンパイル時間 | 776 ms |
コンパイル使用メモリ | 81,528 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 13:41:26 |
合計ジャッジ時間 | 1,450 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cstring> #include <climits> #include <cmath> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { int u, v; double w; }; ll MOD = 1000000007; ll _MOD = 1000000009; ll MOD2 = 1LL << 32; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; void rotate(vector<ll>& a) { ll tmp = a[0]; a[0] = a[1]; a[1] = a[2]; a[2] = tmp; } int main() { vector<ll> X(3), Y(3); for (int i = 0; i < 3; i++) cin >> X[i] >> Y[i]; for (int k = 0; k < 3; k++) { rotate(X); rotate(Y); ll x1 = X[1] - X[0], y1 = Y[1] - Y[0]; ll x2 = X[2] - X[0], y2 = Y[2] - Y[0]; if (x1 * x1 + y1 * y1 != x2 * x2 + y2 * y2) continue; if (x1 * x2 + y1 * y2 != 0) continue; cout << X[0] + x1 + x2 << ' ' << Y[0] + y1 + y2 << endl; return 0; } cout << -1 << endl; }