結果

問題 No.3074 Divide Points Fairly
ユーザー GOTKAKO
提出日時 2025-03-28 22:03:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 204,828 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-28 22:03:24
合計ジャッジ時間 5,571 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

random_device rnd;
mt19937 mt(rnd());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N; N *= 2;
    vector<pair<int,int>> XY(N);
    for(auto &[x,y] : XY) cin >> x >> y;
    N /= 2;

    while(true){
        long long a = mt()%200001,b = mt()%200001;
        a -= 100000,b -= 100000;
        if(a == 0 && b == 0) continue;

        vector<long long> C;
        for(auto [x,y] : XY) C.emplace_back(-a*x-b*y);
        sort(C.begin(),C.end());
        long long c0 = C.at(N-1),c1 = C.at(N);
        if(c0 == c1 || c0+1 == c1) continue;
        cout << a << " " << b << " " << c0+1 << endl; break; 
    }
}
0