# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
91111 |
2018-12-26T09:46:44 Z |
inom |
UFO (IZhO14_ufo) |
C++14 |
|
2000 ms |
52780 KB |
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define int long long
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define in freopen("robots.in", "r", stdin);
#define out freopen("robots.out", "w", stdout);
using namespace std;
const int N = 100100;
const int MOD = 1e9;
const int INF = 1e15;
int TN = 1;
int n, m, r, k, p;
vector<vector<int>> a;
void solve() {
cin >> n >> m >> r >> k >> p;
a.resize(n + 1, vector<int>(m + 1));
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> a[i][j];
}
}
for (int i = 1; i <= k; i++) {
char c; int x, h;
cin >> c >> x >> h;
if (c == 'W' || c == 'E') {
if (c == 'W') {
int cnt = r, j = 1;
while (j <= m && cnt > 0) {
if (a[x][j] >= h) {
a[x][j]--; cnt--;
}
j++;
}
}
else {
int cnt = r, j = m;
while (j >= 1 && cnt > 0) {
if (a[x][j] >= h) {
a[x][j]--; cnt--;
}
j--;
}
}
}
else {
if (c == 'N') {
int cnt = r, j = 1;
while (j <= n && cnt > 0) {
if (a[j][x] >= h) {
a[j][x]--; cnt--;
}
j++;
}
}
else {
int cnt = r, j = n;
while (j >= 1 && cnt > 0) {
if (a[j][x] >= h) {
a[j][x]--; cnt--;
}
j--;
}
}
}
}
int ans = 0; p--;
for (int i = 1; i + p <= n; i++) {
for (int j = 1; j + p <= m; j++) {
int sum = 0;
for (int u = i; u <= i + p; u++) {
for (int v = j; v <= j + p; v++) {
sum += a[u][v];
}
}
ans = max(ans, sum);
}
}
cout << ans << "\n";
return;
}
signed main() {
// ios_base::sync_with_stdio(0);
// in; out; // cin >> TN;
while (TN--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
10 ms |
568 KB |
Output is correct |
5 |
Correct |
42 ms |
1760 KB |
Output is correct |
6 |
Correct |
194 ms |
8560 KB |
Output is correct |
7 |
Execution timed out |
2049 ms |
19180 KB |
Time limit exceeded |
8 |
Execution timed out |
2065 ms |
21840 KB |
Time limit exceeded |
9 |
Execution timed out |
2069 ms |
24460 KB |
Time limit exceeded |
10 |
Execution timed out |
2073 ms |
27448 KB |
Time limit exceeded |
11 |
Execution timed out |
2072 ms |
29708 KB |
Time limit exceeded |
12 |
Execution timed out |
2078 ms |
32908 KB |
Time limit exceeded |
13 |
Execution timed out |
2070 ms |
39180 KB |
Time limit exceeded |
14 |
Correct |
1778 ms |
39180 KB |
Output is correct |
15 |
Execution timed out |
2066 ms |
39180 KB |
Time limit exceeded |
16 |
Execution timed out |
2066 ms |
39180 KB |
Time limit exceeded |
17 |
Execution timed out |
2054 ms |
41024 KB |
Time limit exceeded |
18 |
Execution timed out |
2061 ms |
41536 KB |
Time limit exceeded |
19 |
Execution timed out |
2059 ms |
41536 KB |
Time limit exceeded |
20 |
Execution timed out |
2065 ms |
52780 KB |
Time limit exceeded |