Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. package uri;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class uri1800 {
  6. public static void main(String[] args) {
  7. Scanner input = new Scanner(System.in);
  8. int[] Q;
  9. int[] E;
  10. int n, x, y, i, si, key = 0, a = 0, b = 0;
  11. n = input.nextInt();
  12.  
  13. x = input.nextInt();
  14. E = new int[x];
  15.  
  16. for(si = 0; si < x; si++) {
  17. E[si] = input.nextInt();
  18. }
  19.  
  20. Q = new int[n];
  21. for(i = 0; i < n; i++) {
  22. Q[i] = input.nextInt();
  23.  
  24. }
  25. for(i = 0; i < n; i++) {
  26. key = Q[i];
  27.  
  28.  
  29. for(i = 0; i < x; i++) {
  30. if(E[i] == key) {
  31.  
  32. a++;
  33. }
  34. }
  35.  
  36.  
  37. for(y = 0; y < i; y++) {
  38. if(Q[y] == key) {
  39.  
  40. b++;
  41. }
  42. }
  43.  
  44. if((a == 0) && (b == 0)) {
  45. System.out.println("1");
  46.  
  47. }
  48. if((a != 0) || (b != 0)) {
  49. System.out.println("0");
  50. }
  51.  
  52. }
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement