Submission #467007

# Submission time Handle Problem Language Result Execution time Memory
467007 2021-08-21T09:12:08 Z LucaIlie Maxcomp (info1cup18_maxcomp) C
60 / 100
500 ms 12696 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 < n; l2++ ) {
                for ( c2 = 0; c2 < m; c2++ ) {
                    w = abs( a[l1][c1] - a[l2][c2] ) - abs( l1 - l2 ) - abs( 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 14 ms 496 KB Output is correct
10 Correct 14 ms 504 KB Output is correct
11 Correct 14 ms 496 KB Output is correct
12 Correct 14 ms 496 KB Output is correct
13 Correct 18 ms 460 KB Output is correct
14 Correct 15 ms 460 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 2 ms 204 KB Output is correct
12 Correct 14 ms 496 KB Output is correct
13 Correct 14 ms 504 KB Output is correct
14 Correct 14 ms 496 KB Output is correct
15 Correct 14 ms 496 KB Output is correct
16 Correct 18 ms 460 KB Output is correct
17 Correct 15 ms 460 KB Output is correct
18 Execution timed out 1090 ms 12696 KB Time limit exceeded
19 Halted 0 ms 0 KB -