fork download
  1.  
  2. /* package whatever; // don't place package name! */
  3.  
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // your code goes here
  14. Scanner s = new Scanner(System.in);
  15. int n = s.nextInt();
  16. int a[] = new int[n];
  17. int b[] = new int[n];
  18. int c[] = new int[n];
  19. int count = 0;
  20. for(int i=0; i<n; i++ ){
  21. a[i] = s.nextInt();
  22. }
  23. for(int i=0; i<n; i++ ){
  24. b[i] = s.nextInt();
  25. }
  26. for(int i=0; i<n; i++ ){
  27. c[i] = s.nextInt();
  28. }
  29. for(int i=0; i<n; i++){
  30.  
  31. for(int j=0; j<n; j++){
  32. if(a[i]> b[j]){
  33. i++;
  34. break;
  35. }
  36. for( int k=0; k<n; k++){
  37. if(a[i]<b[j] && b[j]<c[k]){
  38. count++;
  39. }
  40. }
  41. }
  42. }
  43. System.out.println(count);
  44.  
  45. }
  46. }
Success #stdin #stdout 0.09s 35288KB
stdin
2
1 5
2 4
3 6
stdout
3