Saleh127

CF 1213B

Jul 1st, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. int main()
  7. {
  8. fellow_junior
  9.  
  10. test
  11. {
  12. ll a[200000],c,d=0,e=10000000,f,i,j,k,l;
  13. cin>>c;
  14. for(i=1;i<=c;i++)
  15. {
  16. cin>>a[i];
  17. }
  18. for(i=c;i>=1;i--)
  19. {
  20. if(a[i]>e) d++;
  21. else e=a[i];
  22. }
  23. cout<<d<<endl;
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment