fork(4) download
  1. import java.io.PrintWriter;
  2. import java.util.Scanner;
  3.  
  4. public class SagheerAndCrossroads_MainSolution {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. Scanner sc = new Scanner(System.in);
  9. PrintWriter out = new PrintWriter(System.out);
  10.  
  11. int[][] part = new int[4][4];
  12. for(int i = 0; i < 4; ++i)
  13. for(int j = 0; j < 4; ++j)
  14. part[i][j] = sc.nextInt();
  15. int[] crossed = new int[4];
  16. for(int i = 0; i < 4; ++i)
  17. for(int j = 1; j <= 3; ++j)
  18. {
  19. crossed[i] |= part[i][3 - j];
  20. crossed[(i + j) % 4] |= part[i][3 - j];
  21. }
  22.  
  23. boolean accident = false;
  24. for(int i = 0; i < 4; ++i)
  25. accident |= crossed[i] + part[i][3] == 2;
  26. out.println(accident ? "YES" : "NO");
  27.  
  28. sc.close();
  29. out.close();
  30. }
  31. }
  32.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:4: error: class SagheerAndCrossroads_MainSolution is public, should be declared in a file named SagheerAndCrossroads_MainSolution.java
public class SagheerAndCrossroads_MainSolution {
       ^
1 error
stdout
Standard output is empty