답안 #67111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
67111 2018-08-13T10:47:25 Z ege_eksi Maxcomp (info1cup18_maxcomp) C++14
15 / 100
8 ms 672 KB
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<algorithm>

using namespace std;

long long int a[1000][1000];

int main()
{
	int n , m;
	scanf("%d %d",&n,&m);
	
	for(int i = 0 ; i < n ; i++)
	{
		for(int j = 0 ; j < m ; j++)
		{
			scanf("%lli",&a[i][j]);
		}
	}
	
	int i1 , j1 , i2 , j2;
	
	long long int ans = 0;
	long long int x;
	
	for(i1 = 0 ; i1 < n ; i1++)
	{
		for(j1 = 0 ; j1 < m ; j1++)
		{
			for(i2 = 0 ; i2 < n ; i2++)
			{
				for(j2 = 0 ; j2 < m ; j2++)
				{
					x = max(a[i1][j1] , a[i2][j2]) - min(a[i1][j1] , a[i2][j2]) - (abs(i1-i2) + abs(j1-j2) + 1);
					ans = max(ans , x);
				}
			}
		}
	}
	
	printf("%lli",ans);
	
	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:20:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lli",&a[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 4 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 488 KB Output is correct
2 Correct 8 ms 672 KB Output is correct
3 Correct 7 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 4 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Incorrect 4 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -