提出 #23789798


ソースコード 拡げる

#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
#define overload4(_1, _2, _3, _4, name, ...) name
#define overload3(_1, _2, _3, name, ...) name
#define rep1(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = n; i--;)
#define rrep2(i, n) for (ll i = n; i--;)
#define rrep3(i, a, b) for (ll i = b; i-- > (a);)
#define rrep4(i, a, b, c)                                                      \
  for (ll i = (a) + ((b) - (a)-1) / (c) * (c); i >= (a); i -= c)
#define rrep(...)                                                              \
  overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define elif else if
ll beki(ll i) { return 1ll << i; }
#define skip(M)                                                                \
  if (M)                                                                       \
  continue
#define all(v) v.begin(), v.end()
#define allm(x, y, M) for (auto [(x), (y)] : (M))
#define alls(i, S) for (auto(&i) : (S))
#define pb push_back
#define fi first
#define se second
#define outno                                                                  \
  print("NO");                                                                 \
  return
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MAX_N1 = 200010;
const ll MAX_N2 = 500010;
template <class X> void print(X x) { cout << x << endl; }
void print(vl x) {
  for (ll i : x) {
    cout << i << " ";
  }
  cout << endl;
}
void print(vector<PP> x) {
  for (PP i : x) {
    cout << i.first << " " << i.second << endl;
  }
  cout << endl;
}
template <class X> int lbound(vector<X> &Y, X a) {
  return lower_bound(all(Y), a) - Y.begin();
}
template <class X> int ubound(vector<X> &Y, X a) {
  return upper_bound(all(Y), a) - Y.begin();
}
template <class X> X lbound2(vector<X> &Y, X a, int mode = 0) {
  int x = lbound(Y, a) - mode;
  if (x < 0 || x >= Y.size())
    return INF;
  return Y[x];
}
template <class X> X ubound2(vector<X> &Y, X a, int mode = 0) {
  int x = ubound(Y, a) - mode;
  if (x < 0 || x >= Y.size())
    return INF;
  return Y[x];
}
template <class... T> void cl(T &... t) { (..., (t.clear())); }
template <class... T> void in(T &... t) { (..., (cin >> t)); }
template <class... T> void put(vl &V, int n, int mode = 0) {
  ll k;
  if (mode == 0)
    cl(V);
  rep(i, n) {
    cin >> k;
    V.pb(k);
  }
}
int max_index(vl &V) { return max_element(all(V)) - V.begin(); }
int min_index(vl &V) { return min_element(all(V)) - V.begin(); }
ll sum(vl &V) { return accumulate(all(V), 0ll); }
template <typename T> void UNIQUE(vector<T> &v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
template <typename T> T ADD(T a, T b) {
  T res;
  return __builtin_add_overflow(a, b, &res) ? numeric_limits<T>::max() : res;
}
template <typename T> T MUL(T a, T b) {
  T res;
  return __builtin_mul_overflow(a, b, &res) ? numeric_limits<T>::max() : res;
};
template <typename T> T POW(T a, int n) {
  T res = 1;
  for (; n > 0; n >>= 1, a *= a)
    if (n & 1)
      res *= a;
  return res;
}
template <class X> bool ma(X &a, X b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class X> bool mi(X &a, X b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
void vset(vl &A, ll n, ll k) { A = vl(n, k); }
void so(vl &A) { sort(all(A)); }
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, m, u, v;
ll codeforces = 1;
string S, T, U;
vl A, B, C, D;
vector<PP> VP, VP2;
set<ll> s1, s2;
vector<complex<double>> V1, V2;
void solve() {
  in(n);
  rep(i, n) {
    in(x, y);
    V1.pb({complex<double>(x, y)});
  }
  rep(i, n) {
    in(x, y);
    V2.pb({complex<double>(x, y)});
  }
  rep(i, 1, n) { V1[i] -= V1[0]; }
  V1[0] -= V1[0];
  rep(i, n) {
    rep(j, n) {
      // print({i, j});
      // print(abs(V1[1]));
      // print(abs(V2[j] - V2[i]));
      if (abs(abs(V1[1]) - abs(V2[j] - V2[i])) > 1e-5)
        continue;
      complex<double> x = (V2[j] - V2[i]) / V1[1];

      /// print(x);
      rep(h, n) {
        complex<double> y = x * V1[h] + V2[i];
        p = 0;
        rep(k, n) {
          if (abs(y - V2[k]) < 1e-5) {
            p++;
            break;
          }
        }
        if (p == 0)
          goto next;
      }
      print("Yes");
      return;
    next:
      f = 1;
    }
  }
  print("No");
}
int main() {
  cout << fixed << setprecision(15);
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cin >> codeforces;
  while (codeforces--) {
    ans = 0;
    solve();
  }
}

提出情報

提出日時
問題 D - Congruence Points
ユーザ misty1999
言語 C++ (GCC 9.2.1)
得点 400
コード長 5111 Byte
結果 AC
実行時間 12 ms
メモリ 3696 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 4
AC × 64
セット名 テストケース
Sample example0.txt, example1.txt, example2.txt, example3.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, example0.txt, example1.txt, example2.txt, example3.txt, killer_T_01.txt, killer_T_02.txt, killer_T_03.txt, killer_T_04.txt, killer_T_05.txt, killer_T_06.txt, killer_T_07.txt, killer_T_08.txt, killer_T_09.txt, killer_T_10.txt, killer_T_11.txt, killer_T_12.txt, killer_T_13.txt, killer_T_14.txt
ケース名 結果 実行時間 メモリ
000.txt AC 12 ms 3612 KiB
001.txt AC 3 ms 3516 KiB
002.txt AC 6 ms 3696 KiB
003.txt AC 2 ms 3620 KiB
004.txt AC 2 ms 3576 KiB
005.txt AC 7 ms 3544 KiB
006.txt AC 3 ms 3696 KiB
007.txt AC 2 ms 3628 KiB
008.txt AC 2 ms 3600 KiB
009.txt AC 2 ms 3584 KiB
010.txt AC 2 ms 3512 KiB
011.txt AC 2 ms 3524 KiB
012.txt AC 2 ms 3640 KiB
013.txt AC 3 ms 3640 KiB
014.txt AC 2 ms 3624 KiB
015.txt AC 4 ms 3528 KiB
016.txt AC 2 ms 3588 KiB
017.txt AC 2 ms 3588 KiB
018.txt AC 3 ms 3592 KiB
019.txt AC 2 ms 3652 KiB
020.txt AC 2 ms 3548 KiB
021.txt AC 2 ms 3516 KiB
022.txt AC 2 ms 3524 KiB
023.txt AC 3 ms 3680 KiB
024.txt AC 2 ms 3588 KiB
025.txt AC 2 ms 3636 KiB
026.txt AC 2 ms 3504 KiB
027.txt AC 3 ms 3652 KiB
028.txt AC 2 ms 3524 KiB
029.txt AC 2 ms 3592 KiB
030.txt AC 2 ms 3596 KiB
031.txt AC 2 ms 3648 KiB
032.txt AC 2 ms 3684 KiB
033.txt AC 2 ms 3580 KiB
034.txt AC 2 ms 3588 KiB
035.txt AC 2 ms 3520 KiB
036.txt AC 2 ms 3588 KiB
037.txt AC 3 ms 3580 KiB
038.txt AC 2 ms 3524 KiB
039.txt AC 2 ms 3632 KiB
040.txt AC 1 ms 3588 KiB
041.txt AC 2 ms 3592 KiB
042.txt AC 2 ms 3500 KiB
043.txt AC 1 ms 3516 KiB
044.txt AC 2 ms 3516 KiB
045.txt AC 1 ms 3520 KiB
example0.txt AC 2 ms 3488 KiB
example1.txt AC 2 ms 3624 KiB
example2.txt AC 2 ms 3572 KiB
example3.txt AC 2 ms 3572 KiB
killer_T_01.txt AC 2 ms 3516 KiB
killer_T_02.txt AC 3 ms 3688 KiB
killer_T_03.txt AC 2 ms 3584 KiB
killer_T_04.txt AC 2 ms 3688 KiB
killer_T_05.txt AC 5 ms 3644 KiB
killer_T_06.txt AC 2 ms 3600 KiB
killer_T_07.txt AC 2 ms 3588 KiB
killer_T_08.txt AC 2 ms 3684 KiB
killer_T_09.txt AC 2 ms 3576 KiB
killer_T_10.txt AC 4 ms 3648 KiB
killer_T_11.txt AC 2 ms 3596 KiB
killer_T_12.txt AC 3 ms 3508 KiB
killer_T_13.txt AC 2 ms 3516 KiB
killer_T_14.txt AC 2 ms 3628 KiB