結果
| 問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-15 23:31:21 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| コード長 | 776 bytes |
| 記録 | |
| コンパイル時間 | 1,476 ms |
| コンパイル使用メモリ | 186,836 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-12 23:52:26 |
| 合計ジャッジ時間 | 2,661 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
bool is_rectangle(pair<int, int> a[4]) {
vector<int> x;
for(int i = 0; i < 4; i++) {
for(int j = i + 1; j < 4; j++) {
int s = (a[i].first - a[j].first);
int t = (a[i].second - a[j].second);
x.push_back(s * s + t * t);
}
}
sort(x.begin(), x.end());
return x[0] == x[3] && x[4] == x[5] && x[0] * 2 == x[5];
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
pair<int, int> a[4];
for(int i = 0; i < 3; i++) {
cin >> a[i].first >> a[i].second;
}
for(int i = -200; i <= 200; i++) {
for(int j = -200; j <= 200; j++) {
a[3].first = i;
a[3].second = j;
if(is_rectangle(a)) {
cout << i << " " << j << endl;
return 0;
}
}
}
cout << -1 << endl;
return 0;
}