Submission #467001

# Submission time Handle Problem Language Result Execution time Memory
467001 2021-08-21T08:52:45 Z LucaIlie Maxcomp (info1cup18_maxcomp) C
15 / 100
1 ms 204 KB
#include <stdio.h>

#define MAX_N 1000

int a[MAX_N][MAX_N];

int abs( int a ) {
    return a > 0 ? a : -a;
}

int main() {
    int n, m, maxW, w, l, c, l1, c1, l2, c2;

    scanf( "%d%d", &n, &m );
    for ( l = 0; l < n; l++ ) {
        for ( c = 0; c < m; c++ )
            scanf( "%d", &a[l][c] );
    }

    maxW = -1;
    for ( l1 = 0; l1 < n; l1++ ) {
        for ( c1 = 0; c1 < m; c1++ ) {
            for ( l2 = 0; l2 <= l1; l2++ ) {
                for ( c2 = 0; c2 <= c1; c2++ ) {
                    w = abs( a[l1][c1] - a[l2][c2] ) - (l1 - l2 + c1 - c2 + 1);
                    if ( w > maxW )
                        maxW = w;
                }
            }
        }
    }

    printf( "%d", maxW );

    return 0;
}

Compilation message

maxcomp.c: In function 'main':
maxcomp.c:14:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf( "%d%d", &n, &m );
      |     ^~~~~~~~~~~~~~~~~~~~~~~
maxcomp.c:17:13: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf( "%d", &a[l][c] );
      |             ^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Halted 0 ms 0 KB -