結果

問題 No.2353 Guardian Dogs in Spring
ユーザー momoyuu
提出日時 2023-07-12 14:49:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 145,316 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 04:37:25
合計ジャッジ時間 7,377 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<map>
#include<functional>
//#include<bits/stdc++.h>
using namespace std;
using ll = long long;


ll gcd(ll a,ll b){
    if(b) return gcd(b,a%b);
    return a;
}

int main(){
    int n;
    cin>>n;
    vector<ll> x(n),y(n);
    for(int i = 0;i<n;i++) cin>>x[i]>>y[i];
    vector<pair<int,int>> ans;
    vector<int> idx(n);
    for(int i = 0;i<n;i++) idx[i] = i;
    sort(idx.begin(),idx.end(),[&](int i,int j){
        if(x[i]!=x[j]) return x[i] < x[j];
        return y[i] < y[j];});
    vector<int> use(n,0);
    cout<<n/2<<endl;
    for(int i = 0;i<n;i+=2){
        if(i+1>=n) break;
        cout<<idx[i]+1<<" "<<idx[i+1]+1<<endl;
    }

}
0