結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
motxx
|
| 提出日時 | 2014-11-03 00:54:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 891 bytes |
| コンパイル時間 | 1,521 ms |
| コンパイル使用メモリ | 160,888 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-14 13:41:36 |
| 合計ジャッジ時間 | 2,364 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P;
#define rep(i,n) for(int i=0;i<n;i++)
bool cmp (P const& a, P const& b) {
if(a.real() != b.real()) return a.real() < b.real();
return a.imag() < b.imag();
}
int main() {
P ps[3];
int x, y;
rep(i, 3) {
cin >> x >> y;
ps[i] = P(x, y);
}
int per[3]; rep(i, 3) per[i] = i;
bool ok = 0;
P ans;
do {
P v = ps[per[1]] - ps[per[0]];
double len = abs(v);
if(ps[per[1]] + v*P(0,1) != ps[per[2]]) continue;
P p3 = ps[per[2]] + v*P(0,1)*P(0,1);
if(ps[per[0]] != p3 + v*P(0,1)*P(0,1)*P(0,1)) continue;
ok = 1;
ans = p3;
break;
} while(next_permutation(per, per+3));
if(ok) {
cout << (int)ans.real() << " " << (int)ans.imag() << endl;
}
else {
cout << -1 << endl;
}
return 0;
}
motxx