結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
![]() |
提出日時 | 2016-02-16 05:32:29 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,212 bytes |
コンパイル時間 | 1,707 ms |
コンパイル使用メモリ | 169,776 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 13:53:32 |
合計ジャッジ時間 | 2,446 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++)#define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++)#define all(n) (n).begin(),(n).end()typedef long long ll;typedef vector<int> Vi;typedef vector<Vi> VVi;typedef pair<long long,long long> Pii;typedef vector<Pii> VPii;typedef complex<int> P;P in(){int x,y;cin >> x >> y;return P(x,y);}int main(){vector<P> p;rep(i,3)p.push_back(in());rep(i,3)rep(j,3)if( i != j ){set<int> s = {0,1,2};s.erase(i);s.erase(j);int k = *s.begin();P v = p[j] - p[i];P a = p[i];P b = p[j];P c = p[j] + P(v.imag(),-v.real());P d = p[i] + P(v.imag(),-v.real());// cout << a << " " << b << " " << c << " " << d << endl;if( c == p[k] && norm(a-b) == norm(b-c) && norm(a-b) == norm(c-d) && norm(a-b) == norm(d-a) ){//cout << norm(a-b) << " " << norm(b-c) << " " << norm(c-d) << endl;cout << d.real() << " " << d.imag() << endl;return 0;}else if( d == p[k] && norm(a-b) == norm(b-c) && norm(a-b) == norm(c-d) && norm(a-b) == norm(d-a) ){cout << c.real() << " " << c.imag() << endl;return 0;}}cout << -1 << endl;}