結果
| 問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
| コンテスト | |
| ユーザー |
sio_puyo
|
| 提出日時 | 2014-11-03 01:22:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,901 bytes |
| コンパイル時間 | 1,297 ms |
| コンパイル使用メモリ | 162,496 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 13:41:43 |
| 合計ジャッジ時間 | 2,090 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8 fixed<<setprecision(8)
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
typedef pair<int,int> PII;
PII addpii(PII a,PII b){ return MP(a.first+b.first,a.second+b.second); }
PII subpii(PII a,PII b){ return MP(a.first-b.first,a.second-b.second); }
PII rot(PII a)
{
int x,y;
tie(x,y)=a;
return MP(-y,x);
}
PII p3_sq(PII a,PII b,PII c)
{
if(rot(subpii(a,b))==subpii(a,c))
return subpii(addpii(b,c),a);
else return MP(10000,10000);
}
void printpii(PII a)
{
cout << a.first << ' ' << a.second << endl;
}
int main(void)
{
PII a,b,c,answer;
cin >> a.first >> a.second;
cin >> b.first >> b.second;
cin >> c.first >> c.second;
answer=p3_sq(a,b,c);
if(answer.first!=10000){
printpii(answer);
return 0;
}
answer=p3_sq(a,c,b);
if(answer.first!=10000){
printpii(answer);
return 0;
}
answer=p3_sq(b,a,c);
if(answer.first!=10000){
printpii(answer);
return 0;
}
answer=p3_sq(b,c,a);
if(answer.first!=10000){
printpii(answer);
return 0;
}
answer=p3_sq(c,a,b);
if(answer.first!=10000){
printpii(answer);
return 0;
}
answer=p3_sq(c,b,a);
if(answer.first!=10000){
printpii(answer);
return 0;
}
cout << -1 << endl;
return 0;
}
sio_puyo