# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
338018 |
2020-12-22T09:11:30 Z |
boykut |
UFO (IZhO14_ufo) |
C++14 |
|
2000 ms |
5356 KB |
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, k, r, p;
cin >> n >> m >> r >> k >> p;
int a[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < k; i++) {
char ch; cin >> ch;
int pos, h; cin >> pos >> h;
pos--;
if (ch == 'N') {
int cnt = 0;
for (int i = 0; i < n && cnt < r; i++) {
if (a[i][pos] >= h) {
a[i][pos] --;
cnt++;
if (cnt == r) break;
}
}
} else if (ch == 'E') {
int cnt = 0;
for (int i = m - 1; i >= 0 && cnt < r; i--) {
if (a[pos][i] >= h) {
a[pos][i] --;
cnt++;
if (cnt == r) break;
}
}
} else if (ch == 'W') {
int cnt = 0;
for (int i = 0; i < m && cnt < r; i++) {
if (a[pos][i] >= h) {
a[pos][i] --;
cnt++;
if (cnt == r) break;
}
}
} else {
int cnt = 0;
for (int i = n - 1; i >= 0 && cnt < r; i--) {
if (a[i][pos] >= h) {
a[i][pos] --;
cnt++;
if (cnt == r) break;
}
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
//cout << a[i][j] << ' ';
}
//cout << '\n';
}
int sum = 0, ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (i + p <= n && j + p <= m) {
sum = 0;
for (int i1 = i; i1 < i + p; i1++) {
for (int j1 = j; j1 < j + p; j1++) {
sum += a[i1][j1];
}
}
if (sum > ans) {
//cout << i << ' ' << j << '\n';
ans = sum;
//cout << sum << "\n\n";
}
}
}
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
4 ms |
492 KB |
Output is correct |
5 |
Correct |
16 ms |
1004 KB |
Output is correct |
6 |
Correct |
72 ms |
2796 KB |
Output is correct |
7 |
Execution timed out |
2058 ms |
4848 KB |
Time limit exceeded |
8 |
Execution timed out |
2050 ms |
4844 KB |
Time limit exceeded |
9 |
Execution timed out |
2069 ms |
5100 KB |
Time limit exceeded |
10 |
Execution timed out |
2070 ms |
5212 KB |
Time limit exceeded |
11 |
Execution timed out |
2080 ms |
4844 KB |
Time limit exceeded |
12 |
Execution timed out |
2076 ms |
5100 KB |
Time limit exceeded |
13 |
Execution timed out |
2074 ms |
4936 KB |
Time limit exceeded |
14 |
Correct |
1436 ms |
4908 KB |
Output is correct |
15 |
Execution timed out |
2083 ms |
5192 KB |
Time limit exceeded |
16 |
Execution timed out |
2024 ms |
4588 KB |
Time limit exceeded |
17 |
Execution timed out |
2058 ms |
5356 KB |
Time limit exceeded |
18 |
Execution timed out |
2025 ms |
4076 KB |
Time limit exceeded |
19 |
Execution timed out |
2062 ms |
4716 KB |
Time limit exceeded |
20 |
Execution timed out |
2055 ms |
4744 KB |
Time limit exceeded |