結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー Lay_ecLay_ec
提出日時 2014-11-03 00:36:30
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 923 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 78,392 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 00:24:34
合計ジャッジ時間 1,803 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>

using namespace std;


int main()
{	
	vector<int> x(4),y(4);
	for(int i=0;i<3;i++) cin>>x[i]>>y[i];

	for(int X=-100;X<=100;X++){
		for(int Y=-100;Y<=100;Y++){
			x[3]=X; y[3]=Y;

			vector<long> len;
			for(int i=0;i<4;i++){
				for(int j=i+1;j<4;j++){
					long l=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
					
					len.push_back(l);
				}
			}
			sort(len.begin(),len.end());

			//111122
			long a=len[0],b=len[4];
			bool f=true;
			if(2*a!=b && a==0) continue;

			for(int i=1;i<4 && f;i++){
				if(a!=len[i]) f=false;
			}
			for(int i=4;i<6 && f;i++){
				if(b!=len[i]) f=false;
			}

			if(f){ cout<<X<<" "<<Y<<endl; return 0;}

		}
	}
	cout<<-1<<endl;

	return 0;
}
0