結果
| 問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-28 06:35:53 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,122 bytes |
| 記録 | |
| コンパイル時間 | 3,822 ms |
| コンパイル使用メモリ | 340,120 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-01-28 06:35:58 |
| 合計ジャッジ時間 | 4,780 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int dis(int x1, int x2, int y1, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
int x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
int dis01 = dis(x1, x2, y1, y2);
int dis02 = dis(x1, x3, y1, y3);
int dis03 = dis(x2, x3, y2, y3);
vector<int> d0 = {dis01, dis02, dis03};
sort(d0.begin(), d0.end());
if (d0[0] != d0[1]) {
cout << -1 << endl;
return 0;
}
if (d0[0] + d0[1] != d0[2]) {
cout << -1 << endl;
return 0;
}
for (int x4 = -100; x4 <= 100; x4++) {
for (int y4 = -100; y4 <= 100; y4++) {
int dis1 = dis(x1, x4, y1, y4);
int dis2 = dis(x2, x4, y2, y4);
int dis3 = dis(x3, x4, y3, y4);
vector<int> d = {dis1, dis2, dis3};
sort(d.begin(), d.end());
if (d[0] != d[1]) continue;
if (d[0] + d[1] == d[2]) {
cout << x4 << ' ' << y4 << '\n';
return 0;
}
}
}
cout << -1 << endl;
return 0;
}