# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
45423 | choikiwon | Maxcomp (info1cup18_maxcomp) | C++17 | 2 ms | 640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int N, M;
int A[1010][1010];
int mn1[1010], mn2[1010];
int main() {
scanf("%d %d", &N, &M);
for(int i = 0; i < N; i++) {
for(int j = 0; j < M; j++) {
scanf("%d", &A[i][j]);
}
}
int ans = -2e9;
for(int i = 0; i < M; i++) {
mn1[i] = 2e9;
mn2[i] = 2e9;
}
for(int i = N - 1; i >= 0; i--) {
int tmn1 = 2e9;
int tmn2 = 2e9;
for(int j = 0; j < M; j++) {
ans = max(ans, A[i][j] + i - j - tmn1 - 1);
mn1[j] = min(mn1[j], A[i][j] + i - j);
tmn1 = min(tmn1, mn1[j]);
}
for(int j = M - 1; j >= 0; j--) {
ans = max(ans, A[i][j] + i + j - tmn2);
mn2[j] = min(mn2[j], A[i][j] + i + j);
tmn2 = min(tmn2, mn2[j]);
}
}
for(int i = 0; i < M; i++) {
mn1[i] = 2e9;
mn2[i] = 2e9;
}
for(int i = 0; i < N; i++) {
int tmn1 = 2e9;
int tmn2 = 2e9;
for(int j = M - 1; j >= 0; j--) {
ans = max(ans, A[i][j] - (i - j) - tmn1 - 1);
mn1[j] = min(mn1[j], A[i][j] - (i - j));
tmn1 = min(tmn1, mn1[j]);
}
for(int j = 0; j < M; j++) {
ans = max(ans, A[i][j] - (i + j) - tmn2 - 1);
mn2[j] = min(mn2[j], A[i][j] - (i + j));
tmn2 = min(tmn2, mn2[j]);
}
}
printf("%d", ans);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |