Submission #96461

# Submission time Handle Problem Language Result Execution time Memory
96461 2019-02-09T14:26:03 Z dnass Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 5084 KB
#include <cstdio>
#include <algorithm>
using namespace std;

int n, m;
int a[1005][1005];

int myabs(int x){
	if(x<0) return (-1)*x;
	return x;
}

int main(){
	scanf("%d %d", &n, &m);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			scanf("%d", &a[i][j]);
		}
	}
	int mx = -1;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			for(int k=0;k<n;k++){
				for(int l=0;l<m;l++){
					mx = max(mx, myabs(a[i][j]-a[k][l])-myabs(k-i)-myabs(l-j)-1);
				}
			}
		}
	}
	printf("%d\n", mx);
	return 0;
}

Compilation message

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
maxcomp.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &a[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 15 ms 504 KB Output is correct
10 Correct 15 ms 504 KB Output is correct
11 Correct 15 ms 504 KB Output is correct
12 Correct 16 ms 512 KB Output is correct
13 Correct 15 ms 504 KB Output is correct
14 Correct 15 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 15 ms 504 KB Output is correct
13 Correct 15 ms 504 KB Output is correct
14 Correct 15 ms 504 KB Output is correct
15 Correct 16 ms 512 KB Output is correct
16 Correct 15 ms 504 KB Output is correct
17 Correct 15 ms 504 KB Output is correct
18 Execution timed out 1066 ms 5084 KB Time limit exceeded
19 Halted 0 ms 0 KB -