fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. int n,k=0;
  11. n=in.nextInt();
  12. double a[][] = new double [n][n];
  13. int b[] = new int [n];
  14. for (int i=0; i<n; i++){
  15. for (int j=0; j<n; j++){
  16. a[i][j]=in.nextDouble();
  17. }
  18. }
  19. for (int i=0; i<n; i++){
  20. b[i]=1;
  21. for (int j=0; j<n-1; j++){
  22. if (a[i][j]>a[i][j+1]){b[i]=0; break;}
  23. }
  24. }
  25. for (int i=0; i<n; i++){System.out.printf("%d ",b[i]);}
  26. }
  27. }
Success #stdin #stdout 0.18s 321344KB
stdin
5
1 2 3 4 5
6 5 4 3 2 
0 1 2 3 4
-5 1 3 4 0
1 3 3.5 4.3 5 
stdout
1 0 1 0 1