結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー Lay_ecLay_ec
提出日時 2014-11-03 00:47:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 895 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 78,468 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 22:03:59
合計ジャッジ時間 2,126 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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=-200;X<=200;X++){
		for(int Y=-200;Y<=200;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());

			if(len[0]==0 || len[5]==0) continue;

			int c1,c2;
			c1=count(len.begin(),len.end(),len[0]);
			c2=count(len.begin(),len.end(),len[5]);

			if(c1==4 && c2==2 && 2*len[0]==len[5]){
			 	cout<<X<<" "<<Y<<endl;
				return 0;
			}

		}
	}
	cout<<-1<<endl;

	return 0;
}
0