結果
問題 | No.55 正方形を描くだけの簡単なお仕事です。 |
ユーザー | sugim48 |
提出日時 | 2014-11-03 00:24:22 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 1,400 bytes |
コンパイル時間 | 913 ms |
コンパイル使用メモリ | 85,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-26 22:03:13 |
合計ジャッジ時間 | 2,217 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 14 ms
5,248 KB |
testcase_01 | AC | 25 ms
5,376 KB |
testcase_02 | AC | 14 ms
5,376 KB |
testcase_03 | AC | 14 ms
5,376 KB |
testcase_04 | AC | 26 ms
5,376 KB |
testcase_05 | AC | 26 ms
5,376 KB |
testcase_06 | AC | 27 ms
5,376 KB |
testcase_07 | AC | 26 ms
5,376 KB |
testcase_08 | AC | 26 ms
5,376 KB |
testcase_09 | AC | 26 ms
5,376 KB |
testcase_10 | AC | 26 ms
5,376 KB |
testcase_11 | AC | 9 ms
5,376 KB |
testcase_12 | AC | 26 ms
5,376 KB |
testcase_13 | AC | 21 ms
5,376 KB |
testcase_14 | AC | 13 ms
5,376 KB |
testcase_15 | AC | 25 ms
5,376 KB |
testcase_16 | AC | 14 ms
5,376 KB |
testcase_17 | AC | 25 ms
5,376 KB |
testcase_18 | AC | 8 ms
5,376 KB |
testcase_19 | AC | 26 ms
5,376 KB |
testcase_20 | AC | 14 ms
5,376 KB |
testcase_21 | AC | 13 ms
5,376 KB |
testcase_22 | AC | 25 ms
5,376 KB |
testcase_23 | AC | 17 ms
5,376 KB |
testcase_24 | AC | 7 ms
5,376 KB |
ソースコード
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cstring> #include <climits> #include <cmath> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { int u, v; double w; }; ll MOD = 1000000007; ll _MOD = 1000000009; ll MOD2 = 1LL << 32; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; bool check(vector<int>& x, vector<int>& y) { vector<int> v; for (int i = 0; i < 4; i++) for (int j = i + 1; j < 4; j++) { int dx = x[i] - x[j], dy = y[i] - y[j]; v.push_back(dx * dx + dy * dy); } sort(v.begin(), v.end()); int l = v[0]; if (l == 0) return false; // 点が重なる return v[0]==l && v[1]==l && v[2]==l && v[3]==l && v[4]==l*2 && v[5]==l*2; } int main() { vector<int> X(4), Y(4); for (int i = 0; i < 3; i++) cin >> X[i] >> Y[i]; for (int x = -200; x <= 200; x++) for (int y = -200; y <= 200; y++) { X[3] = x; Y[3] = y; if (check(X, Y)) { cout << x << ' ' << y << endl; return 0; } } cout << -1 << endl; }