結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2015-09-22 14:40:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,745 bytes |
| コンパイル時間 | 696 ms |
| コンパイル使用メモリ | 72,736 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 08:37:19 |
| 合計ジャッジ時間 | 1,465 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 3 |
ソースコード
#include<iostream>
#include<math.h>
#include<vector>
#include <array>
#include <algorithm>
#include <queue>
#include <numeric>
#include <map>
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) //printf(__VA_ARGS__)
typedef pair<int, int> pos;
int pos::*x = &pos::first;
int pos::*y = &pos::second;
int dxy[] = {0, 1, 0, -1, 0};
/*================================*/
pos p1, p2, p3;
int len2(pos p1, pos p2) {
return pow(p1.*x - p2.*x, 2) + pow(p1.*y - p2.*y, 2);
}
signed main()
{
cin >> p1.*x >> p1.*y >> p2.*x >> p2.*y >> p3.*x >> p3.*y;
int len12 = len2(p1, p2);
int len23 = len2(p2, p3);
int len31 = len2(p1, p3);
pos center, h1, h2;
if (len12 == len23) {
// 中心: 2
center = p2;
h1 = p1;
h2 = p3;
} else if (len23 == len31) {
// 中心: 3
center = p3;
h1 = p1;
h2 = p2;
} else if (len31 == len12) {
// 中心: 1
center = p1;
h1 = p3;
h2 = p2;
} else {
// 正方形にならない場合
cout << -1 << endl;
return 0;
}
pos p4, vec;
vec.*x = h1.*x - center.*x;
vec.*y = h1.*y - center.*y;
p4.*x = h2.*x + vec.*x;
p4.*y = h2.*y + vec.*y;
cout << p4.*x << " " << p4.*y << endl;
return 0;
}
koyopro