fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define IO ios_base::sync_with_stdio(0), cin.tie(0),cout.tie(0)
  4. typedef long long ll;
  5. const int N = 1e5 + 4 , MOD = 1e9 + 7 ;
  6. int n , a[N] , p[N] , x[N] , mn ;
  7. int solve(int idx)
  8. {
  9. if(idx == n + 1)
  10. return mn ;
  11. if(a[idx] < x[idx])
  12. mn = min (mn , p[idx]) ;
  13. solve(idx + 1) ;
  14. return mn ;
  15. }
  16. int main() {
  17. IO ;
  18. mn = INT32_MAX ;
  19. cin>>n ;
  20. for(int i=1 ; i <= n ; i++)
  21. cin>>a[i]>>p[i]>>x[i] ;
  22. if(solve(1) == INT32_MAX)
  23. cout<<-1<<'\n' ;
  24. else
  25. cout<<solve(1) ;
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5488KB
stdin
Standard input is empty
stdout
-1