結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー nenuon
提出日時 2017-07-01 17:57:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 967 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 89,696 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 23:54:38
合計ジャッジ時間 1,612 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main(){
  int x[3], y[3];
  int X[4], Y[4];
  FOR (i, 0, 3) {
    cin >> x[i] >> y[i];
  }
  int v[3] = {0,1,2};
  do {
    FOR (i, 0, 3) {
      X[i] = x[v[i]];
      Y[i] = y[v[i]];
    }
    int dy = Y[1] - Y[0];
    int dx = X[1] - X[0];
    int nx = X[1] - dy;
    int ny = Y[1] + dx;
    if(nx != X[2] || ny != Y[2]) continue;
    nx = X[2] - dx;
    ny = Y[2] - dy;
    X[3] = nx;
    Y[3] = ny;
    nx = X[3] + dy;
    ny = Y[3] - dx;
    if(nx != X[0] || ny != Y[0]) continue;
    cout << X[3] << " " << Y[3] << endl;
    return 0;
  } while (next_permutation(v, v + 3));
  cout << -1 << endl;
  return 0;
}
0