結果

問題 No.3074 Divide Points Fairly
ユーザー Zhiyuan Chen
提出日時 2025-03-28 21:15:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,354 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 86,304 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-28 21:15:29
合計ジャッジ時間 4,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
struct Pt {
    int x, y;
};
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int total = 2 * N;
    vector<Pt> pts(total);
    for (int i = 0; i < total; i++){
        cin >> pts[i].x >> pts[i].y;
    }
    vector<Pt> ptsY = pts;
    sort(ptsY.begin(), ptsY.end(), [](const Pt &a, const Pt &b){
        return a.y < b.y;
    });
    if(ptsY[N-1].y < ptsY[N].y){
        int y1 = ptsY[N-1].y, y2 = ptsY[N].y;
        int a = 0, b = 2, c = -(y1 + y2);
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }
    vector<Pt> ptsX = pts;
    sort(ptsX.begin(), ptsX.end(), [](const Pt &a, const Pt &b){
        return a.x < b.x;
    });
    if(ptsX[N-1].x < ptsX[N].x){
        int x1 = ptsX[N-1].x, x2 = ptsX[N].x;
        int a = 2, b = 0, c = -(x1 + x2);
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }
    vector<int> S(total);
    for(int i = 0; i < total; i++){
        S[i] = pts[i].x + pts[i].y;
    }
    sort(S.begin(), S.end());
    if(S[N-1] < S[N]){
        int s1 = S[N-1], s2 = S[N];
        int a = 2, b = 2, c = -(s1 + s2);
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }
    cout << 1 << " " << 0 << " " << -100 << "\n";
    return 0;
}
0