# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1091991 |
2024-09-22T19:11:40 Z |
alex2407 |
UFO (IZhO14_ufo) |
C++17 |
|
2000 ms |
18460 KB |
#include <iostream>
#include <vector>
using namespace std;
vector<vector<long long> > a;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, m, r, k, p, hig, lin, cnt, maxi = 0;
string nav;
cin >> n >> m >> r >> k >> p;
a.resize(n);
for (int i = 0; i < n; i++) {
a[i].resize(m);
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
for (int i = 0; i < k; i++) {
cnt = r;
cin >> nav >> lin >> hig;
lin--;
if (nav == "S") {
for (int j = n - 1; j >= 0 && cnt; j--) {
if (a[j][lin] >= hig) {
a[j][lin]--;
cnt--;
}
}
}
if (nav == "N") {
for (int j = 0; j < n && cnt; j++) {
if (a[j][lin] >= hig) {
cnt--;
a[j][lin]--;
}
}
}
if (nav == "W") {
for (int j = 0; j < m && cnt; j++) {
if (a[lin][j] >= hig) {
a[lin][j]--;
cnt--;
}
}
}
if (nav == "E") {
for (int j = m - 1; j >= 0 && cnt; j--) {
if (a[lin][j] >= hig) {
cnt--;
a[lin][j]--;
}
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (!(i) && !(j)) {
continue;
} else if (!(i)) {
a[i][j] += a[i][j - 1];
} else if (!(j)) {
a[i][j] += a[i - 1][j];
} else {
a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
}
}
}
for (int i = p - 1; i < n; i++) {
for (int j = p - 1; j < m; j++) {
if (i == p - 1 && j == p - 1) {
maxi = max(maxi, a[i][j]);
} else if (i == p - 1) {
maxi = max(maxi, a[i][j] - a[i][j - p]);
} else if (j == p - 1) {
maxi = max(maxi, a[i][j] - a[i][j - p]);
} else {
maxi = max(maxi, a[i][j] - a[i - p][j] - a[i][j - p] + a[i - p][j - p]);
}
}
}
cout << maxi << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
5 |
Correct |
11 ms |
1540 KB |
Output is correct |
6 |
Incorrect |
40 ms |
7348 KB |
Output isn't correct |
7 |
Execution timed out |
2048 ms |
14564 KB |
Time limit exceeded |
8 |
Execution timed out |
2024 ms |
11088 KB |
Time limit exceeded |
9 |
Execution timed out |
2056 ms |
11236 KB |
Time limit exceeded |
10 |
Execution timed out |
2096 ms |
11348 KB |
Time limit exceeded |
11 |
Execution timed out |
2037 ms |
10576 KB |
Time limit exceeded |
12 |
Execution timed out |
2044 ms |
11360 KB |
Time limit exceeded |
13 |
Execution timed out |
2062 ms |
15188 KB |
Time limit exceeded |
14 |
Incorrect |
1014 ms |
11092 KB |
Output isn't correct |
15 |
Execution timed out |
2055 ms |
12652 KB |
Time limit exceeded |
16 |
Execution timed out |
2057 ms |
10532 KB |
Time limit exceeded |
17 |
Execution timed out |
2013 ms |
18460 KB |
Time limit exceeded |
18 |
Execution timed out |
2049 ms |
12948 KB |
Time limit exceeded |
19 |
Execution timed out |
2057 ms |
10700 KB |
Time limit exceeded |
20 |
Execution timed out |
2059 ms |
10324 KB |
Time limit exceeded |