結果

問題 No.2355 Unhappy Back Dance
ユーザー KumaTachiRenKumaTachiRen
提出日時 2023-06-16 22:38:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,977 bytes
コンパイル時間 4,953 ms
コンパイル使用メモリ 270,660 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-06 21:02:29
合計ジャッジ時間 10,100 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 297 ms
4,380 KB
testcase_17 AC 285 ms
4,376 KB
testcase_18 AC 298 ms
4,380 KB
testcase_19 AC 302 ms
4,376 KB
testcase_20 AC 293 ms
4,380 KB
testcase_21 AC 120 ms
4,380 KB
testcase_22 AC 22 ms
4,380 KB
testcase_23 AC 25 ms
4,380 KB
testcase_24 AC 262 ms
4,380 KB
testcase_25 AC 134 ms
4,380 KB
testcase_26 AC 137 ms
4,380 KB
testcase_27 AC 121 ms
4,376 KB
testcase_28 AC 4 ms
4,384 KB
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 244 ms
4,380 KB
testcase_31 AC 176 ms
4,376 KB
testcase_32 AC 17 ms
4,376 KB
testcase_33 AC 100 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 4 ms
4,376 KB
testcase_36 AC 124 ms
4,380 KB
testcase_37 AC 63 ms
4,384 KB
testcase_38 AC 74 ms
4,376 KB
testcase_39 AC 61 ms
4,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>

using namespace std;
using namespace atcoder;

struct Fast {
  Fast() {
    std::cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
  }
} fast;

#define popcount(x) __builtin_popcount(x)
#define all(a) (a).begin(), (a).end()
#define contains(a, x) ((a).find(x) != (a).end())
#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (a); i--)
#define YN(b) cout << ((b) ? "YES" : "NO") << "\n";
#define Yn(b) cout << ((b) ? "Yes" : "No") << "\n";
#define yn(b) cout << ((b) ? "yes" : "no") << "\n";

using ll = long long;

template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  using lll = __int128_t;
  using P = pair<lll, lll>;
  auto Area = [&](P p) {
    if (p.first > 0 && p.second >= 0) return 0;
    if (p.first <= 0 && p.second > 0) return 1;
    if (p.first < 0 && p.second <= 0) return 2;
    if (p.first >= 0 && p.second < 0) return 3;
    return -1;
  };

  int n;
  cin >> n;
  vector<P> pos(n);
  rep(i, 0, n) {
    ll x, y;
    cin >> x >> y;
    pos[i] = P(x, y);
  }
  int ans = 0;
  rep(i, 0, n) {
    vector<P> possub;
    rep(j, 0, n) {
      if (i != j) possub.push_back(P(pos[j].first - pos[i].first, pos[j].second - pos[i].second));
    }
    sort(all(possub), [Area](P const &p1, P const &p2) {
      if (Area(p1) != Area(p2)) return Area(p1) < Area(p2);
      return p1.first * p2.second - p1.second * p2.first >= 0;
    });
    for (int j = 0; j + 1 < (int)possub.size(); j++) {
      auto p1 = possub[j];
      auto p2 = possub[j + 1];
      if (p1.first * p2.first + p1.second * p2.second > 0 && p1.first * p2.second - p1.second * p2.first == 0) {
        ans++;
        break;
      }
    }
  }
  cout << ans << "\n";
}
0