結果
問題 |
No.3074 Divide Points Fairly
|
ユーザー |
|
提出日時 | 2025-03-28 22:05:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,382 bytes |
コンパイル時間 | 2,055 ms |
コンパイル使用メモリ | 200,644 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-28 22:05:20 |
合計ジャッジ時間 | 7,307 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 31 WA * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int total = 2 * N; vector<pair<int,int>> pts(total); for (int i = 0; i < total; i++){ cin >> pts[i].first >> pts[i].second; } vector<double> posThreshold, negThreshold; int countZero = 0; for (int i = 0; i < total; i++){ int x = pts[i].first, y = pts[i].second; if(x > 0){ posThreshold.push_back((y - 0.5) / x); } else if(x < 0){ negThreshold.push_back((y - 0.5) / x); } else { if(y > 0.5) countZero++; } } sort(posThreshold.begin(), posThreshold.end()); sort(negThreshold.begin(), negThreshold.end()); // f(k) = (x>0: #T > k) + (x<0: #T < k) + countZero for (int k = -50000; k <= 50000; k++){ int countPos = posThreshold.size() - (upper_bound(posThreshold.begin(), posThreshold.end(), (double)k) - posThreshold.begin()); int countNeg = lower_bound(negThreshold.begin(), negThreshold.end(), (double)k) - negThreshold.begin(); int f = countPos + countNeg + countZero; if(f == N){ int A = 2 * k; int B = -2; long long C = 1; cout << A << " " << B << " " << C; return 0; } } return 0; }