I am getting below error:
TESTCASE # 1 : wrong-answer (Time: 0.14 s)
TESTCASE # 2 : wrong-answer (Time: 0.14 s)
TESTCASE # 3 : wrong-answer (Time: 0.15 s)
TESTCASE # 4 : wrong-answer (Time: 0.13 s)
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int r = scn.nextInt();
int c = scn.nextInt();
int[][] m = new int[r][c];
for(int i =0; i<r;i++)
{
for(int j =0; j<c;j++){
m[i][j] = scn.nextInt();;
}
}
int y = 0;
boolean x = true;
while(y<c){
if(x)
{
for(int i =0; i<r;i++)
System.out.print(m[i][y]+", ");
}
else{
for(int i =r-1; i>=0;i--)
System.out.print(m[i][y]+", ");
}
x =!x;
y++;
}
}
}