fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,t,s,sl=-1,ot=1,ans=0,cs=-1,usot=0;
  6. scanf("%d",&n);
  7. for(int i=0; i<n; i++)
  8. {
  9. scanf("%d",&t);
  10. switch(t)
  11. {
  12. case(1): scanf("%d",&s);
  13. cs=s;
  14. if(sl!=-1&&s>sl) ans++;
  15. break;
  16. case(2): if(!ot) ans+=usot; usot=0;
  17. break;
  18. case(3): scanf("%d",&s);
  19. if(cs>s) ans++;
  20. sl=s;
  21. break;
  22. case(4): ot=1; usot=0; break;
  23. case(5): sl=-1; break;
  24. case(6): usot++;ot=0; break;
  25. }
  26. }
  27. printf("%d",ans);
  28. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty