結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー face4
提出日時 2018-05-21 19:41:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 66,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 15:32:22
合計ジャッジ時間 1,293 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int x[3], y[3];
    for(int i = 0; i < 3; i++)  cin >> x[i] >> y[i];

    int order[3] = {0,1,2};
    bool frag = false;
    int vecx;
    int vecy;

    do{
        vecx = x[order[2]]-x[order[1]];
        vecy = y[order[2]]-y[order[1]];

        if(x[order[1]]-(vecy) == x[order[0]] && (y[order[1]]+vecx) == y[order[0]]){
            frag = true;
            break;
        }
    }while(next_permutation(order, order+3));

    if(frag){
        cout << (x[order[0]] + vecx) << " " << (y[order[0]] + vecy) << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}
0