結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー |
|
提出日時 | 2022-09-29 22:08:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 68 ms / 5,000 ms |
コード長 | 1,096 bytes |
コンパイル時間 | 2,063 ms |
コンパイル使用メモリ | 207,068 KB |
最終ジャッジ日時 | 2025-02-07 18:27:16 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i = 0; i < (n); i++)using namespace std;typedef long long ll;int main(){cin.tie(0);ios::sync_with_stdio(0);vector<pair<int,int>> P(3);for(auto &[x, y] : P) cin >> x >> y;for(int x = -200; x <= 200; x++) {for(int y = -200; y <= +200; y++) {P.push_back({x, y});if([x, y](vector<pair<int,int>> P) {sort(P.begin(), P.end());int ok = 1;auto g = [](pair<int,int> a, pair<int,int> b) {auto [ax, ay] = a;auto [bx, by] = b;return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);};multiset<int> st;rep(i,4)rep(j,i) st.insert(g(P[i], P[j]));ok &= st.count(*st.begin()) == 4 && st.count(*st.rbegin()) == 2;return ok;}(P)) {cout << x << " " << y << endl;return 0;}P.pop_back();}}cout << -1 << endl;}