답안 #76560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
76560 2018-09-14T18:35:41 Z Vardanyan Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 13400 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int a[N][N];
int main(){
    long long ans = -1;
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=m;j++){
            scanf("%d",&a[i][j]);

        }
    }
    for(int i = 1;i<=n;i++){
        for(int j = 1;j<=m;j++){
            for(int ii = 1;ii<=n;ii++){
                for(int jj = 1;jj<=m;jj++){
                    long long d = abs(ii-i)+abs(jj-j)+1;
                    long long x = abs(a[i][j]-a[ii][jj]);
                    x-=d;
                    ans = max(ans,x);
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

maxcomp.cpp: In function 'int main()':
maxcomp.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
maxcomp.cpp:11:18: 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 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 408 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 508 KB Output is correct
2 Correct 7 ms 508 KB Output is correct
3 Correct 5 ms 680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 408 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 472 KB Output is correct
9 Correct 23 ms 748 KB Output is correct
10 Correct 19 ms 768 KB Output is correct
11 Correct 22 ms 936 KB Output is correct
12 Correct 22 ms 960 KB Output is correct
13 Correct 23 ms 1048 KB Output is correct
14 Correct 20 ms 1048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 408 KB Output is correct
5 Correct 2 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 472 KB Output is correct
9 Correct 5 ms 508 KB Output is correct
10 Correct 7 ms 508 KB Output is correct
11 Correct 5 ms 680 KB Output is correct
12 Correct 23 ms 748 KB Output is correct
13 Correct 19 ms 768 KB Output is correct
14 Correct 22 ms 936 KB Output is correct
15 Correct 22 ms 960 KB Output is correct
16 Correct 23 ms 1048 KB Output is correct
17 Correct 20 ms 1048 KB Output is correct
18 Execution timed out 1055 ms 13400 KB Time limit exceeded
19 Halted 0 ms 0 KB -