fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cin>>n;
  7. int max,j,b[n],player1[n],player2[n];
  8. for(int i=0;i<n;i++)
  9. {
  10. cin>>player1[i];
  11. cin>>player2[i];
  12. }
  13.  
  14. for(int i=0;i<n;i++)
  15. {
  16. if(player1[i]>player2[i])
  17. b[i]=player1[i]-player2[i];
  18. else
  19. b[i]=player2[i]-player1[i];
  20. }
  21. max=b[0];
  22. for(int i=0;i<n;i++)
  23. {
  24. if(max<b[i])
  25. {
  26. max=b[i];
  27. j=i;
  28. }
  29. }
  30. if(player1[j]>player2[j])
  31. cout<<"1";
  32. else
  33. cout<<"2\t";
  34. cout<<max<<endl;
  35.  
  36. system("pause");
  37. return 0;
  38. }
Success #stdin #stdout #stderr 0s 15240KB
stdin
5
140
82
89
134
90
110
112
106
88
90
stdout
2	58
stderr
sh: 1: pause: not found