| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 17460 | azecoder | UFO (IZhO14_ufo) | C++98 | 0 ms | 2016 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <memory.h>
#include <queue>
#include <cmath>
#include <map>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000
#define MOD 1000000
using namespace std;
int N, M, R, K, P, x, h, ans;
char ch;
int main()
{
freopen("ufo.in", "r", stdin);
freopen("ufo.out", "w", stdout);
scanf("%d %d %d %d %d", &N, &M, &R, &K, &P);
int a[N + 1][M + 1];
for (int i = 1; i <= N; i++)
for (int j = 1; j <= M; j++)
scanf("%d", &a[i][j]);
int k = K;
while (k--) {
scanf(" %c %d %d", &ch, &x, &h);
int r = R;
if (ch == 'N') for (int i = 1; i <= N; i++) if (r && a[i][x] >= h) a[i][x]--, r--;
else if (!r) break;
if (ch == 'W') for (int i = 1; i <= M; i++) if (r && a[x][i] >= h) a[x][i]--, r--;
else if (!r) break;
if (ch == 'E') for (int i = M; i >= 1; i--) if (r && a[x][i] >= h) a[x][i]--, r--;
else if (!r) break;
if (ch == 'S') for (int i = N; i >= 1; i--) if (r && a[i][x] >= h) a[i][x]--, r--;
else if (!r) break;
}
for (int i = 1; i <= N - P + 1; i++)
for (int j = 1; j <= M - P + 1; j++) {
int c = 0;
for (int k = i; k < i + P; k++)
for (int l = j; l < j + P; l++)
c += a[k][l];
ans = max(ans, c);
}
cout << ans << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
