제출 #47238

#제출 시각아이디문제언어결과실행 시간메모리
47238PowerOfNinjaGoMaxcomp (info1cup18_maxcomp)C++17
60 / 100
1065 ms13316 KiB
//Power Of Ninja Go
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii;
#define X first
#define Y second
#define pb push_back
const int maxn = 1e3+5;
int arr[maxn][maxn];
int main()
{
    int n, m; scanf("%d %d", &n, &m);
    for(int i = 1; i<= n; i++)
    {
        for(int j = 1; j<= m; j++)
        {
            scanf("%d", arr[i]+j);
        }
    }
    ll best = -1e18;
    for(int i = 1; i<= n; i++)
    {
        for(int j = 1; j<= m; j++)
        {
            for(int i2 = 1; i2<= n; i2++)
            {
                for(int j2 = 1; j2<= m; j2++)
                {
                    best = max(best, -1LL*abs(i-i2)-abs(j-j2)-1+abs(arr[i][j]-arr[i2][j2]));
                }
            }
        }
    }
    cout << best << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:13:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, m; scanf("%d %d", &n, &m);
               ~~~~~^~~~~~~~~~~~~~~~~
maxcomp.cpp:18:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", arr[i]+j);
             ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...