結果
| 問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-28 09:31:24 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 897 bytes |
| 記録 | |
| コンパイル時間 | 6,443 ms |
| コンパイル使用メモリ | 340,544 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-28 09:31:33 |
| 合計ジャッジ時間 | 7,086 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 d1 = dis(x1, x2, y1, y2);
int d2 = dis(x1, x3, y1, y3);
int d4 = dis(x2, x3, y2, y3);
for (int x4 = -100; x4 <= 100; x4++) {
for (int y4 = -100; y4 <= 100; y4++) {
int d3 = dis(x1, x4, y1, y4);
int d5 = dis(x3, x4, y3, y4);
int d6 = dis(x2, x4, y2, y4);
vector<int> d = {d1, d2, d3, d4, d5, d6};
sort(d.begin(), d.end());
if (d[0] == d[1] && d[1] == d[2] && d[2] == d[3] &&
d[0] * 2 == d[5] && d[4] == d[5]) {
cout << x4 << ' ' << y4 << '\n';
return 0;
}
}
}
cout << -1 << endl;
}