結果
問題 |
No.55 正方形を描くだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2018-01-15 14:56:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,576 bytes |
コンパイル時間 | 759 ms |
コンパイル使用メモリ | 86,768 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-24 02:35:41 |
合計ジャッジ時間 | 2,105 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 3 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; int main() { vector< pair<int,int> > P; for ( int i = 0; i < 3; i++ ) { int x,y; cin >> x >> y; P.push_back(make_pair( x,y )); } vector<int> V = {0,1,2,3}; for ( int x = -200; x <= 200; x++ ) { for ( int y = -200; y <= 200; y++ ) { bool ng = false; for ( int i = 0; i < 3; i++ ) { if ( x == P[i].first && y == P[i].second ) { ng = true; } } if ( ng ) { continue; } P.push_back(make_pair(x,y) ); bool is_ok = true; do { int p = ( P[V[0]].first-P[V[1]].first ) * ( P[V[2]].first-P[V[3]].first ) + ( P[V[0]].second-P[V[1]].second ) * ( P[V[2]].second-P[V[3]].second ); int d = ( P[V[0]].first-P[V[1]].first ) * ( P[V[0]].first-P[V[1]].first ) + ( P[V[0]].second-P[V[1]].second ) * ( P[V[0]].second-P[V[1]].second ); if ( p != 0 && p != d && -p != d ) { is_ok = false; } } while ( next_permutation(V.begin(),V.end()) ); if ( is_ok ) { cout << x << " " << y << endl; return 0; } P.pop_back(); } } cout << -1 << endl; return 0; }