CSES - Datatähti 2015 loppu - Results
Submission details
Task:Ruudukko
Sender:Perdex
Submission time:2015-01-29 12:46:52 +0200
Language:Java
Status:COMPILE ERROR

Compiler report

input/Q3.java:6: error: cannot find symbol
    static IO io = new IO();
           ^
  symbol:   class IO
  location: class Q3
input/Q3.java:6: error: cannot find symbol
    static IO io = new IO();
                       ^
  symbol:   class IO
  location: class Q3
2 errors

Code

package asdf;


public class Q3 {
    
    static IO io = new IO();
    static int n;
    static char[][] table;
    static String ans = "";
    
    public static void main(String[] fuckingCopyRightBreaker){
        
        
        n = io.nextInt();
        
        table = new char[n][n];
        
        for(int i = 0; i < n; i++){
            table[i] = io.next().toCharArray();
        }
        
        io.print(goTo(0, 0, ""));
        
        io.close();
    }
    
    
    private static String goTo(int x, int y, String s){
        s += table[x][y];
        
        if(x == n - 1 && y == n - 1){
            
            return s;
            
        }else if(x == n - 1){
            
            return goTo(x, y + 1, s);
            
        }else if(y == n - 1){
            
            return goTo(x + 1, y, s);
            
        }else{
            if((int)table[x + 1][y] == (int)table[x][y + 1]){
                
                String s1 = goTo(x + 1, y, s);
                String s2 = goTo(x, y + 1, s);
                
                if(s1.compareTo(s2) <= 0){
                    return s1;
                }else{
                    return s2;
                }
                
            }else if((int)table[x + 1][y] < (int)table[x][y + 1]){
                
                return goTo(x + 1, y, s);
                
            }else{
                
                return goTo(x, y + 1, s);
                
            }
        }
    }
    
    
    
}