結果
問題 | No.2353 Guardian Dogs in Spring |
ユーザー |
|
提出日時 | 2023-07-06 19:40:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 1,148 ms |
コンパイル使用メモリ | 113,540 KB |
最終ジャッジ日時 | 2025-02-15 06:26:46 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
ソースコード
#include<iostream> #include<set> #include<algorithm> #include<vector> #include<string> #include<set> #include<map> #include<numeric> #include<queue> #include<cmath> using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair<int,int> P; typedef pair<int,P> PP; const ll MOD=998244353; const double PI=acos(-1); int main(){ int N; cin>>N; vector<P> order; map<P,int> dogid; for(int i=0;i<N;i++){ int x,y; cin>>x>>y; order.emplace_back(x,y); dogid[make_pair(x,y)]=i; } vector<pair<int,int>> ans; sort(order.begin(),order.end()); for(int i=0;i+1<N;i+=2){ ans.emplace_back(dogid[order[i]],dogid[order[i+1]]); } cout<<ans.size()<<endl; for(auto [z,w]:ans){ cout<<z+1<<' '<<w+1<<endl; } }