Submission #47238

# Submission time Handle Problem Language Result Execution time Memory
47238 2018-04-29T12:49:48 Z PowerOfNinjaGo Maxcomp (info1cup18_maxcomp) C++17
60 / 100
500 ms 13316 KB
//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;
}

Compilation message

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 time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 692 KB Output is correct
7 Correct 2 ms 692 KB Output is correct
8 Correct 2 ms 692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 692 KB Output is correct
2 Correct 5 ms 692 KB Output is correct
3 Correct 5 ms 800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 692 KB Output is correct
7 Correct 2 ms 692 KB Output is correct
8 Correct 2 ms 692 KB Output is correct
9 Correct 19 ms 820 KB Output is correct
10 Correct 20 ms 936 KB Output is correct
11 Correct 19 ms 936 KB Output is correct
12 Correct 20 ms 1048 KB Output is correct
13 Correct 19 ms 1080 KB Output is correct
14 Correct 19 ms 1080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 596 KB Output is correct
4 Correct 2 ms 596 KB Output is correct
5 Correct 2 ms 596 KB Output is correct
6 Correct 2 ms 692 KB Output is correct
7 Correct 2 ms 692 KB Output is correct
8 Correct 2 ms 692 KB Output is correct
9 Correct 5 ms 692 KB Output is correct
10 Correct 5 ms 692 KB Output is correct
11 Correct 5 ms 800 KB Output is correct
12 Correct 19 ms 820 KB Output is correct
13 Correct 20 ms 936 KB Output is correct
14 Correct 19 ms 936 KB Output is correct
15 Correct 20 ms 1048 KB Output is correct
16 Correct 19 ms 1080 KB Output is correct
17 Correct 19 ms 1080 KB Output is correct
18 Execution timed out 1065 ms 13316 KB Time limit exceeded
19 Halted 0 ms 0 KB -