Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.006 s | 1 KBi |
#2 |
Incorrecto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Incorrecto
|
0.005 s | 1 KBi |
#7 |
Incorrecto
|
0.006 s | 7 KBi |
#8 |
Correcto
|
0.013 s | 1 KBi |
#9 |
Correcto
|
0.012 s | 1 KBi |
#10 |
Correcto
|
0.012 s | 1 KBi |
#11 |
Correcto
|
0.012 s | 1 KBi |
#12 |
Incorrecto
|
0.013 s | 1 KBi |
#13 |
Incorrecto
|
0.013 s | 1 KBi |
#14 |
Incorrecto
|
0.015 s | 1 KBi |
#15 |
Correcto
|
0.015 s | 1 KBi |
#16 |
Incorrecto
|
0.012 s | 1 KBi |
#17 |
Incorrecto
|
0.013 s | 1 KBi |
#18 |
Correcto
|
0.011 s | 7 KBi |
#include <iostream> #include <vector> #include <cassert> #include <algorithm> using namespace std; const int MAXN = 50; int a[MAXN][MAXN]; int main() { int rows, cols; cin >> rows >> cols; assert(1 <= rows and rows <= 50); assert(1 <= cols and cols <= 50); for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { cin >> a[i][j]; } } int answer = a[0][0]; for (int r0 = 0; r0 < rows; ++r0) { vector<int> sum(cols, 0); for (int r1 = r0; r1 < rows; ++r1) { for (int c = 0; c < cols; ++c) { sum[c] += a[r1][c]; } for (int i = 0; i < cols; ++i) { int option = 0; for (int j = i; j < cols; ++j) { option += sum[j]; } answer = max(answer, option); } } } cout << answer << endl; return 0; }