結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー utouto97utouto97
提出日時 2019-03-19 15:38:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,358 bytes
コンパイル時間 3,515 ms
コンパイル使用メモリ 147,868 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 22:43:38
合計ジャッジ時間 2,880 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

#define int long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

pii solve(int x1, int y1, int x2, int y2, int x3, int y3)
{
  int vx1 = x2-x1;
  int vy1 = y2-y1;
  int vx2 = x3-x1;
  int vy2 = y3-y1;

//  printf("%lld %lld %lld %lld\n", vx1, vy1, vx2, vy2);
  if(vx1*vy1+vx2*vy2 != 0) return {inf, inf};
  if(vx1*vx1+vy1*vy1 != vx2*vx2+vy2*vy2) return {inf, inf};

  int nx1 = x3 + vx1;
  int ny1 = y3 + vy1;
  int nx2 = x2 + vx2;
  int ny2 = y2 + vy2;

  if(nx1 == nx2 and ny1 == ny2) return {nx1, ny1};
  return {inf, inf};
}

signed main()
{
  vi x(3), y(3);
  rep(i, 3) cin >> x[i] >> y[i];

  vi num(3);
  iota(all(num), 0);
  do{
    pii ans = solve(x[num[0]], y[num[0]], x[num[1]], y[num[1]], x[num[2]], y[num[2]]);
    if(ans.first != inf and ans.second != inf){
//      cout << num[0] << " " << num[1] << " " << num[2] << endl;
      cout << ans.first << " " << ans.second << endl;
      return 0;
    }
  }while(next_permutation(all(num)));

  cout << -1 << endl;

  return 0;
}
0