結果
| 問題 | No.5020 Averaging | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-02-25 14:30:09 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 1,001 bytes | 
| コンパイル時間 | 2,984 ms | 
| コンパイル使用メモリ | 248,900 KB | 
| 実行使用メモリ | 6,676 KB | 
| スコア | 18,451,359 | 
| 最終ジャッジ日時 | 2024-02-25 14:30:14 | 
| 合計ジャッジ時間 | 4,724 ms | 
| ジャッジサーバーID (参考情報) | judge15 / judge10 | 
| 純コード判定しない問題か言語 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 50 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
struct card{
    ll a,b;
    card(){}
    card(ll a,ll b):a(a),b(b){}
    void print(){
        cout<<a<<" "<<b<<endl;
    }
};
bool operator<(card x,card y){
    if(x.a==y.a)return x.b<y.b;
    else return x.a<y.a;
}
card operator+(card x,card y){
    return card((x.a+y.a)/2,(x.b+y.b)/2);
}
const int m=2;
const ll x=500000000000000000;
int main(){
    int n;
    cin>>n;
    vector<card> c(n);
    random_device seed;
    mt19937 rnd(seed());
    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        c[i]=card(a,b);
    }
    cout<<m<<endl;
    for(int i=0;i<m;i++){
        card t=c[0]+c[1];
        int index=1;
        for(int j=2;j<n;j++){
            card tt=c[0]+c[j];
            if(max(abs(t.a-x),abs(t.b-x))>max(abs(tt.a-x),abs(tt.b-x))){
                index=j;
                t=tt;
            }
        }
        c[0]=t;
        c[index]=t;
        cout<<1<<" ";
        cout<<index+1<<endl;
    }
}
            
            
            
        