fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int n, u, d, t, x;
  4.  
  5. int main() {
  6. cin >> n;
  7. u = 0;
  8. d = 0;
  9. t = 0;
  10. for(int i=1; i<=n; i++){
  11. cin >> x;
  12. if(x == 1){
  13. u = u+1;
  14. }else{
  15. if(x == 2){
  16. d = d+1;
  17. }else{
  18. if(x == 3){
  19. t = t+1;
  20. }
  21. }
  22. }
  23. }
  24. for(int i=1; i<=n; i++){
  25. cin >> x;
  26. if(x == 1){
  27. u = u+1;
  28. }else{
  29. if(x == 2){
  30. d = d+1;
  31. }else{
  32. if(x == 3){
  33. t = t+1;
  34. }
  35. }
  36. }
  37. }
  38. u = u/4;
  39. d = d/4;
  40. t = t/4;
  41. cout << u+d+t;
  42. return 0;
  43. }
Success #stdin #stdout 0s 4568KB
stdin
2
1 0 
0 1
stdout
Standard output is empty