結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー Lay_ecLay_ec
提出日時 2014-11-03 00:46:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 895 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 78,484 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-09 07:20:00
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
4,380 KB
testcase_01 AC 136 ms
4,376 KB
testcase_02 AC 68 ms
4,384 KB
testcase_03 AC 70 ms
4,380 KB
testcase_04 AC 138 ms
4,376 KB
testcase_05 AC 135 ms
4,380 KB
testcase_06 AC 131 ms
4,376 KB
testcase_07 AC 139 ms
4,376 KB
testcase_08 AC 134 ms
4,376 KB
testcase_09 AC 132 ms
4,380 KB
testcase_10 AC 130 ms
4,380 KB
testcase_11 AC 55 ms
4,376 KB
testcase_12 AC 131 ms
4,376 KB
testcase_13 AC 80 ms
4,376 KB
testcase_14 AC 67 ms
4,380 KB
testcase_15 AC 130 ms
4,376 KB
testcase_16 AC 69 ms
4,380 KB
testcase_17 AC 132 ms
4,380 KB
testcase_18 AC 52 ms
4,380 KB
testcase_19 AC 132 ms
4,376 KB
testcase_20 AC 67 ms
4,376 KB
testcase_21 AC 66 ms
4,376 KB
testcase_22 AC 94 ms
4,376 KB
testcase_23 AC 76 ms
4,380 KB
testcase_24 AC 54 ms
4,380 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=-500;X<=500;X++){
		for(int Y=-500;Y<=500;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