結果

問題 No.947 ABC包囲網
ユーザー 紙ぺーぱー紙ぺーぱー
提出日時 2019-12-10 16:38:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 985 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 92,756 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-06 07:11:24
合計ジャッジ時間 10,076 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 3 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 309 ms
4,380 KB
testcase_29 AC 303 ms
4,380 KB
testcase_30 AC 317 ms
4,376 KB
testcase_31 AC 301 ms
4,380 KB
testcase_32 AC 301 ms
4,376 KB
testcase_33 AC 302 ms
4,380 KB
testcase_34 AC 298 ms
4,376 KB
testcase_35 AC 305 ms
4,376 KB
testcase_36 AC 303 ms
4,376 KB
testcase_37 AC 300 ms
4,380 KB
testcase_38 AC 303 ms
4,376 KB
testcase_39 AC 302 ms
4,380 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 303 ms
4,376 KB
testcase_50 WA -
testcase_51 AC 2 ms
4,380 KB
testcase_52 AC 2 ms
4,380 KB
testcase_53 AC 2 ms
4,376 KB
testcase_54 AC 2 ms
4,380 KB
testcase_55 AC 2 ms
4,380 KB
testcase_56 AC 2 ms
4,376 KB
testcase_57 AC 4 ms
4,384 KB
testcase_58 AC 4 ms
4,380 KB
testcase_59 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// http://kmjp.hatenablog.jp/entry/2014/12/15/1000
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define FOR(i, N) for (int i = 0; i < (int)(N); i++)
int N;
vector<ll> x, y;
long long count() {
  int i, j;
  ll ret = 0;
  double pi = atan(1) * 4;
  N = x.size();
  vector<double> V;
  FOR(i, N) {
    double d = atan2(y[i], x[i]);
    if (d < 0) d += 2 * pi;
    V.push_back(d);
    cerr << d << endl;
  }
  sort(V.begin(), V.end());
  FOR(i, N) for (j = i + 1; j < N; j++) {
    if (V[j] < V[i] + pi) {
      int x2 = lower_bound(V.begin(), V.end(), V[i] + pi + 1e-15) - V.begin();
      int y2 = lower_bound(V.begin(), V.end(), V[j] + pi - 1e-15) - V.begin();
      ret += max(0, y2 - x2);
      // cerr << max(0, y2 - x2) << endl;
    }
  }
  return ret;
}

int main() {
  cin >> N;
  FOR(i, N) {
    int u, v;
    cin >> u >> v;
    x.emplace_back(u);
    y.emplace_back(v);
  }
  cout << count() << endl;
}
0