結果
問題 |
No.947 ABC包囲網
|
ユーザー |
![]() |
提出日時 | 2019-12-10 16:38:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 985 bytes |
コンパイル時間 | 1,034 ms |
コンパイル使用メモリ | 99,452 KB |
最終ジャッジ日時 | 2025-01-08 10:23:08 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 47 WA * 13 |
ソースコード
// 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; }