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. cout << u;
  39. u = u%4;
  40. d = d%4;
  41. t = t%4;
  42. cout << u+d+t;
  43. return 0;
  44. }
Success #stdin #stdout 0s 4564KB
stdin
2
1 1
1 1
stdout
40