結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー kyuridenamidakyuridenamida
提出日時 2016-02-16 05:32:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,212 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 167,804 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 22:18:11
合計ジャッジ時間 2,346 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++)
#define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++)
#define all(n) (n).begin(),(n).end()
typedef long long ll;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<long long,long long> Pii;
typedef vector<Pii> VPii;


typedef complex<int> P;

P in(){
	int x,y;
	cin >> x >> y;
	return P(x,y);
}
int main(){
	vector<P> p;
	rep(i,3)p.push_back(in());
	rep(i,3)rep(j,3)
		if( i != j ){
			set<int> s = {0,1,2};
			s.erase(i);
			s.erase(j);
			int k = *s.begin();
			P v = p[j] - p[i];
			P a = p[i];
			P b = p[j];
			P c = p[j] + P(v.imag(),-v.real());
			P d = p[i] + P(v.imag(),-v.real());
			// cout << a << " " << b << " " << c << " " << d << endl;
			if( c == p[k] && norm(a-b) == norm(b-c) && norm(a-b) == norm(c-d) && norm(a-b) == norm(d-a) ){
				//cout << norm(a-b) << " " << norm(b-c) << " " << norm(c-d) << endl;
				cout << d.real() << " " << d.imag() << endl;
				return 0;
			}else if( d == p[k] && norm(a-b) == norm(b-c) && norm(a-b) == norm(c-d) && norm(a-b) == norm(d-a) ){
				cout << c.real() << " " << c.imag() << endl;
				return 0;
			}
		}
	cout << -1 << endl;
}
0