# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
880288 | The_Samurai | UFO (IZhO14_ufo) | C++17 | 2065 ms | 9676 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// I stand with PALESTINE
//#pragma GCC optimize("Ofast,O3")
//#pragma GCC target("avx,avx2")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
void solve() {
int n, m, r, q, p;
cin >> n >> m >> r >> q >> p;
vector<vector<int>> a(n, vector<int>(m));
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) cin >> a[i][j];
}
while (q--) {
char op;
int i, v;
cin >> op >> i >> v;
i--;
if (op == 'W') {
for (int j = 0, c = 0; j < m and c < r; j++) {
if (a[i][j] >= v) {
a[i][j]--;
c++;
}
}
} else if (op == 'E') {
for (int j = m - 1, c = 0; j >= 0 and c < r; j--) {
if (a[i][j] >= v) {
a[i][j]--;
c++;
}
}
} else if (op == 'N') {
for (int j = 0, c = 0; j < n and c < r; j++) {
if (a[j][i] >= v) {
a[j][i]--;
c++;
}
}
} else {
for (int j = n - 1, c = 0; j >= 0 and c < r; j--) {
if (a[j][i] >= v) {
a[j][i]--;
c++;
}
}
}
}
int ans = 0;
for (int i = 0; i <= n - p; i++) {
for (int j = 0; j <= m - p; j++) {
int sum = 0;
for (int x = i; x < i + p; x++) {
for (int y = j; y < j + p; y++) {
sum += a[x][y];
}
}
ans = max(ans, sum);
}
}
cout << ans;
}
int main() {
cin.tie(0)->sync_with_stdio(false);
#ifdef sunnatov
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int q = 1;
// cin >> q;
while (q--) {
solve();
cout << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |