結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
![]() |
提出日時 | 2019-04-08 22:41:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,595 bytes |
コンパイル時間 | 911 ms |
コンパイル使用メモリ | 99,252 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-01 22:55:13 |
合計ジャッジ時間 | 1,765 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include<iostream>#include<cstdio>#include<cstring>#include <cstdlib>#include <cmath>#include<cctype>#include<string>#include<set>#include<iomanip>#include <map>#include<algorithm>#include <functional>#include<vector>#include<climits>#include<stack>#include<queue>#include <deque>#include <climits>#include <typeinfo>#include <utility>#define all(x) (x).begin(),(x).end()#define rep(i,m,n) for(int i = m;i < n;++i)#define pb push_back#define fore(i,a) for(auto &i:a)#define rrep(i,m,n) for(int i = m;i >= n;--i)#define INF INT_MAX/2using namespace std;using ll = long long;using R = double;using Data = pair<ll, vector<int>>;const ll MOD = 1e9 + 7;const ll inf = 1LL << 50;struct edge { ll from; ll to; ll cost; };int mul(pair<int,int>a,pair<int, int>b) {return (a.first*b.first) + (a.second*b.second);}int ln(pair<int, int>a) {return a.first*a.first + a.second * a.second;}int main() {vector<int>po[2];rep(i, 0, 6) {int n;cin >> n;po[i % 2].pb(n);}rep(i, 0, 3) {int xa = po[0][i];int ya = po[1][i];vector<pair<int, int>>v = { {0,0} ,{0,0} };int f = 0;rep(i, 0, 2) {v[f].first -= xa;v[f].second -= ya;f++;}f = 0;int ansx = 0;int ansy = 0;rep(j, 0, 3) {if (i != j) {v[f].first += po[0][j];v[f].second += po[1][j];ansx += po[0][j];ansy += po[1][j];f++;}}ansx -= xa;ansy -= ya;if (mul(v[0], v[1]) == 0 && ln(v[0]) == ln(v[1]) && ln(v[0]) != 0) {cout << ansx << " " << ansy << endl;return 0;}}cout << -1 << endl;return 0;}