30% Wrong Answer

Equipo Rocket asked 3 years ago

¿Por qué me da respuesta incorrecta si produce las mismas salidas que en los ejemplos?

Why does it give me wrong answer if the outputs are the same as in the examples?

#include <iostream>
using namespace std;

int main() {
    int campodegusanos[100][100], celdas, columnas, gusanoscomidos[100], 
        iterador1, iterador2, resultadofinal = 0;
    cin >> celdas >> columnas;
    for(iterador1 = 0; iterador1 < celdas; iterador1++)
        for(iterador2 = 0; iterador2 < columnas; iterador2++) {
            cin >> campodegusanos[iterador1][iterador2];
            gusanoscomidos[iterador2] += campodegusanos[iterador1][iterador2];
            if(gusanoscomidos[iterador2] > resultadofinal) resultadofinal = 
    cout << resultadofinal << endl;
    return 0;

Remember not post solutions. Your post may be reviewed by our moderators.

  • Luis Fernando Veronese Trivelatto replied 3 years ago

    Because the examples are just examples, the tests you really need to pass are the hidden ones ;)

    It seems you're only checking for the biggest sum in a column, you also need to check for biggest sum in a line. For example the following test

    1 4
    10 10 10 10

    should output 40.

    Also, the 'gusanoscomidos' variable isn't explicitly initialized so it might have trash values (see