fork download
  1. #include<iostream>
  2. #include<math.h>
  3. #include<iomanip>
  4. #include<string>
  5. #include<algorithm>
  6. #include<map>
  7. #include<stack>
  8. #include<deque>
  9. #include<cstdio>
  10. #include<queue>
  11. #include<fstream>
  12. using namespace std;
  13. int main() {
  14. ifstream cin("hobby.in");
  15. ofstream cout("hobby.out");
  16. int n,i,j,m,z,x;
  17. pair< int,pair<int,int> >a[1005];
  18. cin>>n;
  19. for(i=0;i<n;i++) {
  20. cin>>a[i].first>>a[i].second.first;
  21. a[i].second.second=i+1;
  22. }
  23. sort(a+0,a+n);
  24. cout<<n/2<<endl;
  25. for(i=1;i<n;i+=2) {
  26. cout<<a[i-1].second.second<<" "<<a[i].second.second<<endl;
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Standard output is empty