結果

問題 No.55 正方形を描くだけの簡単なお仕事です。
ユーザー mmn15277198
提出日時 2021-04-11 13:21:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 3,058 bytes
コンパイル時間 892 ms
コンパイル使用メモリ 97,652 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 08:36:23
合計ジャッジ時間 1,824 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define vi vector<int>
#define vll vector<long long>
#define vb vector<bool>
#define all(x) x.begin() , x.end()
#define pb push_back()
#define eb emplace_back()
typedef long long ll;
typedef long double ld;
//const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ld PI = 3.14159265358979;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int MX = 220000;
ll gcd (ll a , ll b) { if (a < b) swap(a , b); if (a % b == 0) return b; else return gcd(b , a % b); }
ll lcm (ll a , ll b) { return a / gcd(a , b) * b; }
ll lin() { ll x; scanf("%lld" , &x); return x; }
int in() { int x; scanf("%d" , &x); return x; }
void io_setup() {
cout << fixed << setprecision(20);
}
ll modpow (ll x , ll p) {
ll ret = 1;
while (p) {
if (p % 2 == 1) {
ret *= x;
ret %= MOD;
}
x *= x;
x %= MOD;
p /= 2;
}
return ret;
}
ll moddiv (ll a , ll b) {
return a * modpow(b , MOD - 2) % MOD;
}
ll modsub (ll a , ll b) {
if (a >= b) return (a - b) % MOD;
else return (MOD - a + b);
}
vll fact(MX);
vll factinv(MX);
void init_fact () {
fact[0] = 1;
for (int i = 1; i < MX; i++) {
fact[i] = 1LL * i * fact[i - 1] % MOD;
}
for (int i = 0; i < MX; i++) {
factinv[i] = modpow(fact[i] , MOD - 2);
}
}
ll nCk (ll n , ll k) {
return ((fact[n] * factinv[k] % MOD) * factinv[n - k] % MOD);
}
bool is_prime (int x) {
if (x == 2 || x == 3 || x == 5 || x == 7) {
return true;
}
for (ll i = 2; i*i <= x; i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
vb prime_table(MX , true);
void init_prime() {
for (int i = 2; i < MX; i++) {
for (int j = i + i; j <= MX; j += i) {
prime_table[j] = false;
}
}
return;
}
int main() {
io_setup();
//init_fact();
int a , b , c , d , e , f;
cin >> a >> b >> c >> d >> e >> f;
int d1 = (a - c) * (a - c) + (b - d) * (b - d);
int d2 = (a - e) * (a - e) + (b - f) * (b - f);
int d3 = (c - e) * (c - e) + (d - f) * (d - f);
if ((d1 == d2 && d1 * 2 == d3) || (d2 == d3 && d2 * 2 == d1) || (d1 == d3 && d1 * 2 == d2)) {
for (int x = -1000; x <= 1000; x++) {
for (int y = -1000; y <= 1000; y++) {
int d4 = (a - x) * (a - x) + (b - y) * (b - y);
int d5 = (c - x) * (c - x) + (d - y) * (d - y);
int d6 = (e - x) * (e - x) + (f - y) * (f - y);
if ((d4 == d5 && d4 * 2 == d6) || (d5 == d6 && d5 * 2 == d4) || (d4 == d6 && d4 * 2 == d5)) {
cout << x << " " << y << endl;
return 0;
}
}
}
}
cout << -1 << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0