結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー Tatsu_mr
提出日時 2024-10-08 14:29:29
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 856 bytes
コンパイル時間 3,761 ms
コンパイル使用メモリ 248,724 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 14:29:34
合計ジャッジ時間 4,071 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 dx = x1 - x2;
            int dy = y1 - y2;
            cout << x3 + dx << " " << y3 + dy << endl;
            return 0;
        }
    } while (next_permutation(ALL(id)));
    cout << -1 << endl;
}
0