fork(1) download
  1. #include<iostream>
  2. #include<cstdio>
  3. using namespace std;
  4. int main()
  5. {
  6. int long t,i,p1,p2,c,position=0,max=0;
  7. int a[10002];
  8. scanf("%d\n",&t);
  9. for(i=0;i<t;i++)
  10. {
  11. scanf("%d%d",&p1,p2);
  12. if(p1>p2)
  13. {
  14. c=p1-p2;
  15. a[2*i]=c;
  16. a[2*i+1]=1;
  17. }
  18. if(p2>p1)
  19. {
  20. c=p2-p1;
  21. a[2*i]=c;
  22. a[2*i+1]=2;
  23. }
  24.  
  25. }
  26. for(i=0;i<2*t;i++)
  27. {
  28. if(a[2*i]>a[2*i+2])
  29. {
  30. max=a[2*i];
  31. position=2*i+1;
  32. }
  33. }
  34. printf("%d%d",max,a[position]);
  35. }
Runtime error #stdin #stdout 0s 2684KB
stdin
2
12 23
11 13
stdout
Standard output is empty