# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
345473 |
2021-01-07T11:40:21 Z |
l3nl3 |
UFO (IZhO14_ufo) |
C++14 |
|
2000 ms |
8940 KB |
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define exit exit(false)
//#define here() cerr << "herewego\n";
#define show(x) cerr << #x << ": " << x << '\n';
#define int long long
//#define double long double
#define all(a) a.begin(), a.end()
#define whole(a, p, q) a+p, a+p+q
#define ioio() ios_base::sync_with_stdio (0); cin.tie (0); cout.tie (0);
using namespace std;
//using namespace __gnu_pbds;
//typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
signed main () { ioio();
int n, m, r, k, p;
cin >> 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++) {
cin >> a[i][j];
}
}
while (k--) {
char tp;
int x, h;
cin >> tp >> x >> h;
int cn = r;
if (tp == 'N') {
int y = 1;
while (y <= n && cn > 0) {
if (a[y][x] >= h) {
cn--;
a[y][x]--;
}
y++;
}
} else if (tp == 'S') {
int y = n;
while (y >= 1 && cn > 0) {
if (a[y][x] >= h) {
cn--;
a[y][x]--;
}
y--;
}
} else if (tp == 'W') {
int y = 1;
while (y <= m && cn > 0) {
if (a[x][y] >= h) {
cn--;
a[x][y]--;
}
y++;
}
} else {
int y = m;
while (y >= 1 && cn > 0) {
if (a[x][y] >= h) {
cn--;
a[x][y]--;
}
y--;
}
}
}
/*for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cout << a[i][j] << ' ';
}
cout << '\n';
}*/
int mx = -1;
for (int i = p; i <= n; i++) {
for (int j = p; j <= m; j++) {
int sm = 0;
for (int x = i - p + 1; x <= i; x++) {
for (int y = j - p + 1; y <= j; y++) {
sm += a[x][y];
}
}
mx = max (mx, sm);
}
}
cout << mx;
}
# |
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 |
364 KB |
Output is correct |
5 |
Correct |
18 ms |
748 KB |
Output is correct |
6 |
Correct |
82 ms |
4352 KB |
Output is correct |
7 |
Execution timed out |
2049 ms |
8172 KB |
Time limit exceeded |
8 |
Execution timed out |
2072 ms |
8180 KB |
Time limit exceeded |
9 |
Execution timed out |
2086 ms |
8176 KB |
Time limit exceeded |
10 |
Execution timed out |
2041 ms |
8216 KB |
Time limit exceeded |
11 |
Execution timed out |
2090 ms |
7788 KB |
Time limit exceeded |
12 |
Execution timed out |
2076 ms |
8172 KB |
Time limit exceeded |
13 |
Execution timed out |
2025 ms |
8940 KB |
Time limit exceeded |
14 |
Correct |
1986 ms |
7908 KB |
Output is correct |
15 |
Execution timed out |
2067 ms |
8172 KB |
Time limit exceeded |
16 |
Execution timed out |
2037 ms |
7844 KB |
Time limit exceeded |
17 |
Execution timed out |
2041 ms |
8868 KB |
Time limit exceeded |
18 |
Execution timed out |
2062 ms |
7788 KB |
Time limit exceeded |
19 |
Execution timed out |
2064 ms |
8172 KB |
Time limit exceeded |
20 |
Execution timed out |
2073 ms |
8172 KB |
Time limit exceeded |