結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
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<pair<int,int>> ptsY = pts;
    sort(ptsY.begin(), ptsY.end(), [](const pair<int,int>& a, const pair<int,int>& b){
        return a.second < b.second;
    });
    if (ptsY[N-1].second < ptsY[N].second) {
        int yLow = ptsY[N-1].second;
        int yHigh = ptsY[N].second;
        int a = 0;
        int b = 2;
        int c = -(yLow + yHigh);
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }
    vector<pair<int,int>> ptsX = pts;
    sort(ptsX.begin(), ptsX.end(), [](const pair<int,int>& a, const pair<int,int>& b){
        return a.first < b.first;
    });
    if (ptsX[N-1].first < ptsX[N].first) {
        int xLow = ptsX[N-1].first;
        int xHigh = ptsX[N].first;
        int a = 2;
        int b = 0;
        int c = -(xLow + xHigh);
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }
    return 0;
}
0