fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. using ll = long long;
  4. const int MAXN = 1e5;
  5. ll x[MAXN] , z[MAXN];
  6. ll n , y , t , mx , mn , hx ,hn;
  7.  
  8. int main(){
  9. //freopen("HCN.INP" , "r",stdin);
  10. //freopen("HCN.OUT" , "w" , stdout);
  11. cin >> n;
  12. for( int i = 1 ; i<= n ; i++ ){
  13. cin >> x[i] >> y >> z[i] >> t;
  14. }
  15. mx = -1e18;
  16. mn = 1e18;
  17. for( int i = 1 ; i<= n ; i++ ){
  18. if( x[i] > mx ){
  19. mx = x[i];
  20. hx = i;
  21. }
  22. if( z[i] < mn ){
  23. mn = z[i];
  24. hn = i;
  25. }
  26. }
  27. cout << mx - mn << endl;
  28. cout << min(hx,hn) << " " << max(hx,hn);
  29. return 0;
  30. }
Success #stdin #stdout 0s 5320KB
stdin
3
1 0 2 3
3 0 4 1
5 0 6 2
stdout
3
1 3