結果

問題 No.2353 Guardian Dogs in Spring
ユーザー 👑 CleyL
提出日時 2023-07-06 21:11:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 766 ms
コンパイル使用メモリ 79,976 KB
最終ジャッジ日時 2025-02-15 06:27:29
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct d{
  int x,y;
  int i;
  bool operator<(d z){
    if(x == z.x)return y < z.y;
    return x < z.x;
  }
};

int main(){
  int n;cin>>n;
  vector<d> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i].x>>A[i].y;
    A[i].i = i + 1;
  }
  sort(A.begin(), A.end());
  cout << n/2 << endl;
  for(int i = 0; n-1 > i; i+=2){
    cout << A[i].i << " " << A[i+1].i << endl;
  }
}
0