fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int N = 5e5 + 5;
  6. int n;
  7. int dM[367], dF[367];
  8.  
  9. int main()
  10. {
  11. cin>>n;
  12. for(int i = 0; i < n;i++){
  13. char g;
  14. int l,r;
  15. cin>>g>>l>>r;
  16. if(g == 'M'){
  17. for(int j = l; j <= r; j++) dM[j] ++;
  18. }
  19. else{
  20. for(int j = l; j <= r; j++) dF[j] ++;
  21. }
  22. }
  23. int ans = 0;
  24. for(int i = 1; i <= 366; i++){
  25. int num = min(dM[i] , dF[i]) * 2;
  26. ans = max(ans , num);
  27. }
  28. cout<<ans;
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5504KB
stdin
Standard input is empty
stdout
Standard output is empty