답안 #67108

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

using namespace std;

int main()
{
	int n , m;
	scanf("%d %d",&n,&m);
	
	int a[100][100];
	
	for(int i = 0 ; i < n ; i++)
	{
		for(int j = 0 ; j < m ; j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	
	int i1 , j1 , i2 , j2;
	
	int ans = 0;
	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("%d",ans);
	
	return 0;
}

Compilation message

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:12: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("%d",&a[i][j]);
    ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Incorrect 3 ms 520 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 520 KB Output is correct
2 Correct 8 ms 524 KB Output is correct
3 Correct 6 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Incorrect 3 ms 520 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Incorrect 3 ms 520 KB Output isn't correct
4 Halted 0 ms 0 KB -