結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー cureskolcureskol
提出日時 2020-03-25 16:50:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 1,714 ms
コンパイル使用メモリ 174,076 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 11:43:48
合計ジャッジ時間 4,315 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
4,376 KB
testcase_01 AC 84 ms
4,380 KB
testcase_02 AC 36 ms
4,376 KB
testcase_03 AC 36 ms
4,376 KB
testcase_04 AC 70 ms
4,376 KB
testcase_05 AC 84 ms
4,380 KB
testcase_06 AC 83 ms
4,376 KB
testcase_07 AC 82 ms
4,380 KB
testcase_08 AC 85 ms
4,376 KB
testcase_09 AC 86 ms
4,376 KB
testcase_10 AC 85 ms
4,376 KB
testcase_11 AC 25 ms
4,376 KB
testcase_12 AC 71 ms
4,380 KB
testcase_13 AC 48 ms
4,380 KB
testcase_14 AC 36 ms
4,380 KB
testcase_15 AC 82 ms
4,380 KB
testcase_16 AC 37 ms
4,376 KB
testcase_17 AC 70 ms
4,380 KB
testcase_18 AC 25 ms
4,380 KB
testcase_19 AC 84 ms
4,380 KB
testcase_20 AC 37 ms
4,380 KB
testcase_21 AC 36 ms
4,380 KB
testcase_22 AC 59 ms
4,380 KB
testcase_23 AC 43 ms
4,376 KB
testcase_24 AC 25 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int long long

signed main(){
  int x1,y1,x2,y2,x3,y3;cin>>x1>>y1>>x2>>y2>>x3>>y3;
  for(int x4=-300;x4<=300;x4++){
    for(int y4=-300;y4<=300;y4++){
      map<int,int> m;
      m[(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)]++;
      m[(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)]++;
      m[(x1-x4)*(x1-x4)+(y1-y4)*(y1-y4)]++;
      m[(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)]++;
      m[(x4-x2)*(x4-x2)+(y4-y2)*(y4-y2)]++;
      m[(x3-x4)*(x3-x4)+(y3-y4)*(y3-y4)]++;
      if(m.size()!=2)continue;
      int A=m.begin()->first;
      if(m[A]==4&&m[A*2]==2){
        cout<<x4<<" "<<y4<<endl;
        return 0;
      }
    }
  }
  cout<<-1<<endl;
}
0