結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
Tatsu_mr
|
| 提出日時 | 2024-10-08 14:36:00 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,000 bytes |
| コンパイル時間 | 3,488 ms |
| コンパイル使用メモリ | 249,260 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-08 14:36:05 |
| 合計ジャッジ時間 | 4,329 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 WA * 3 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for(long long i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()
using namespace std;
using lint = long long;
int main() {
vector<pair<int, int>> xy(3);
rep(i, 3) {
cin >> xy[i].first >> xy[i].second;
}
auto dist = [](int x1, int y1, int x2, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
};
vector<int> id = {0, 1, 2};
do {
auto [x1, y1] = xy[id[0]];
auto [x2, y2] = xy[id[1]];
auto [x3, y3] = xy[id[2]];
if (dist(x1, y1, x2, y2) == dist(x2, y2, x3, y3)) {
int x4 = x3 + (x1 - x2);
int y4 = y3 + (y1 - y2);
int x4_ = x1 + (x3 - x2);
int y4_ = y1 + (y3 - y2);
if (x4 == x4_ && y4 == y4_) {
cout << x4 << " " << y4 << endl;
return 0;
}
}
} while (next_permutation(ALL(id)));
cout << -1 << endl;
}
Tatsu_mr