結果

問題 No.3664 Manhattan Circumcenter
コンテスト
ユーザー sepa38
提出日時 2026-08-12 15:24:34
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.92.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 114 ms / 2,000 ms
+ 257µs
コード長 921 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,326 ms
コンパイル使用メモリ 205,620 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 13:01:03
合計ジャッジ時間 10,961 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    int px, py, qx, qy, rx, ry;
    cin >> px >> py >> qx >> qy >> rx >> ry;

    auto check = [&](int x){
        assert(0 <= x && x <= 100);
    };
    check(px); check(py);
    check(qx); check(qy);
    check(rx); check(ry);

    vector<pair<double, double>> ans;

    for(int i = -3000; i <= 3000; i++){
        for(int j = -3000; j <= 3000; j++){
            double x = i / 2.0, y = j / 2.0;
            double d1 = abs(px - x) + abs(py - y), 
                   d2 = abs(qx - x) + abs(qy - y), 
                   d3 = abs(rx - x) + abs(ry - y);
            if(d1 == d2 && d2 == d3 && ans.size() < 2){
                ans.emplace_back(x, y);
            }
        }
    }
    if(ans.size() >= 2){
        cout << -1 << endl;
        return 0;
    }
    cout << ans.size() << endl;
    for(auto [x, y] : ans){
        cout << x << " " << y << endl;
    }
}
0