fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define int long long
  6. #define double long double
  7. #define endl "\n"
  8. #define NAME "a"
  9.  
  10. const int MAXN = 1e6 + 5;
  11. const int inf = 1e18;
  12. const int MOD = 1e9 + 7;
  13.  
  14. void FileInput(){
  15. if(fopen(NAME".inp" , "r") == NULL)
  16. freopen(NAME".inp" , "w" , stdout);
  17. freopen(NAME".inp" , "r" , stdin);
  18. freopen(NAME".out" , "w" , stdout);
  19. }
  20.  
  21. int n;
  22. int a[MAXN];
  23.  
  24. void solve(){
  25. cin >> n;
  26. for(int i = 1 ; i <= n ; i++)
  27. cin >> a[i];
  28.  
  29. int cnt = 0;
  30. for(int i = 1 ; i < n ; i++){
  31. bool ok = true;
  32. for(int j = i + 1 ; j <= n ; j++)
  33. if(a[j] >= a[i])
  34. ok = false;
  35. if(ok == true) cnt++;
  36. }
  37. cout << cnt << endl;
  38. }
  39.  
  40. int32_t main(){
  41. //FileInput();
  42. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  43. int t = 1;
  44. // cin >> t;
  45. while(t--)
  46. solve();
  47. return 0;
  48. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
0