Submission #316993

# Submission time Handle Problem Language Result Execution time Memory
316993 2020-10-29T00:33:43 Z daniel920712 Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 12792 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
int all[1005][1005];
int main()
{
    int N,M,ans=-2e9,i,j,k,l;
    scanf("%d %d",&N,&M);
    for(i=0;i<N;i++) for(j=0;j<M;j++) scanf("%d",&all[i][j]);
    for(i=0;i<N;i++)
    {
        for(j=0;j<N;j++)
        {
            for(k=0;k<M;k++)
            {
                for(l=0;l<M;l++) 
                {
                    if(i==j&&k==l) continue;
                    ans=max(ans,abs(all[i][k]-all[j][l])-abs(i-j)-abs(k-l)-1);
                }
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
maxcomp.cpp:11:44: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     for(i=0;i<N;i++) for(j=0;j<M;j++) scanf("%d",&all[i][j]);
      |                                       ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 16 ms 512 KB Output is correct
10 Correct 18 ms 512 KB Output is correct
11 Correct 16 ms 512 KB Output is correct
12 Correct 16 ms 512 KB Output is correct
13 Correct 16 ms 640 KB Output is correct
14 Correct 16 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 3 ms 256 KB Output is correct
10 Correct 3 ms 256 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 16 ms 512 KB Output is correct
13 Correct 18 ms 512 KB Output is correct
14 Correct 16 ms 512 KB Output is correct
15 Correct 16 ms 512 KB Output is correct
16 Correct 16 ms 640 KB Output is correct
17 Correct 16 ms 512 KB Output is correct
18 Execution timed out 1096 ms 12792 KB Time limit exceeded
19 Halted 0 ms 0 KB -