結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー dazydazy
提出日時 2018-06-12 16:39:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,732 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 165,340 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-13 03:39:29
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

struct xy
{
    int x;
    int y;
    bool operator<(const xy& another) const {
        if(x != another.x) {
            return x < another.x;
        } 
        return y < another.y;
    }
};
int main() {
    fastcin;
    xy c[3];
    rep(i, 0, 3) {
        cin >> c[i].x >> c[i].y;
    }
    int d[3];
    int dx, dy;
    d[0] = pow(c[1].x-c[0].x, 2) + pow(c[1].y-c[0].y, 2);
    d[1] = pow(c[2].x-c[1].x, 2) + pow(c[2].y-c[1].y, 2);
    d[2] = pow(c[0].x-c[2].x, 2) + pow(c[0].y-c[2].y, 2);
    if(!d[0]||!d[1]||!d[2]) printf("-1\n");
    else if(d[0]==d[1]) {
        if(d[0]+d[1]==d[2]) {
            dx = c[2].x-c[1].x;
            dy = c[2].y-c[1].y;
            printf("%d %d\n", c[2].x+dy, c[2].y-dx);
        }
    } else if(d[1]==d[2]) {
        if(d[1]+d[2]==d[0]) {
            dx = c[0].x-c[2].x;
            dy = c[0].y-c[2].y;
            printf("%d %d\n", c[0].x+dy, c[0].y-dx);
        }
    } else if(d[2]==d[0]) {
        if(d[2]+d[0]==d[1]) {
            dx = c[1].x-c[0].x;
            dy = c[1].y-c[0].y;
            printf("%d %d\n", c[1].x+dy, c[1].y-dx);
        }
    } else printf("-1\n");
    return 0;
}
0