Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#2 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#3 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#4 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#5 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#6 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#7 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#8 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#9 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#10 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#11 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#12 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#13 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#14 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#15 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#16 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#17 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
||
#18 |
Error de compilación
Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:44: error: cannot find symbol public static Scanner leer = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors |
public class Main { public static void main(String[] args) { //input String dimensiones= leer.nextLine().trim(); int filas=Character.getNumericValue(dimensiones.charAt(0)); int columnas=Character.getNumericValue(dimensiones.charAt(1)); int[][] ejemplo1= new int[filas][columnas]; for (int i = 0; i < filas; i++) { String filaDada= leer.nextLine().trim(); int k=0; for (int j = 0; j < columnas; j++) { if(filaDada.charAt(k)=='-'){ ejemplo1[i][j]=-1*Character.getNumericValue(filaDada.charAt(k+1)); k++; }else{ ejemplo1[i][j]=Character.getNumericValue(filaDada.charAt(k)); } k+=2; System.out.println(ejemplo1[i][j]); } } int toret = valorSubmatrizMaxima(ejemplo1, filas, columnas); System.out.println(toret); } public static Scanner leer = new Scanner(System.in); public static int valorSubmatrizMaxima(int[][] matriz, int filas, int columnas) { //crear matriz con suma de columnas acumulada int[][] matrizSumaColumnas = new int[filas][columnas]; for (int i = 0; i < columnas; i++) { for (int j = 0; j < filas; j++) { if (j == 0) { matrizSumaColumnas[j][i] = matriz[j][i]; } else { matrizSumaColumnas[j][i] = matriz[j][i] + matrizSumaColumnas[j - 1][i]; } } } //algoritmo como el que teniamos en la busqueda del subarray maximo int maximoLocal = Integer.MIN_VALUE;; int minimo, subMatriz; for (int i = 0; i < filas; i++) { for (int j = i; j < filas; j++) { minimo = 0; subMatriz = 0; for (int k = 0; k < columnas; k++) { if (i == 0) { subMatriz += matrizSumaColumnas[j][k]; } else { subMatriz += matrizSumaColumnas[j][k] - matrizSumaColumnas[i - 1][k]; } if (subMatriz < minimo) { minimo = subMatriz; } if ((subMatriz - minimo) > maximoLocal) { maximoLocal = subMatriz - minimo; } } } } return maximoLocal; } }