結果

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

ソースコード

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