Submission #345471

# Submission time Handle Problem Language Result Execution time Memory
345471 2021-01-07T11:37:36 Z l3nl3 UFO (IZhO14_ufo) C++14
0 / 100
2000 ms 13048 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 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 2 ms 404 KB Output isn't correct
4 Incorrect 8 ms 620 KB Output isn't correct
5 Incorrect 25 ms 1644 KB Output isn't correct
6 Incorrect 145 ms 10212 KB Output isn't correct
7 Execution timed out 2045 ms 12344 KB Time limit exceeded
8 Execution timed out 2080 ms 10764 KB Time limit exceeded
9 Execution timed out 2044 ms 11020 KB Time limit exceeded
10 Execution timed out 2025 ms 11148 KB Time limit exceeded
11 Execution timed out 2062 ms 10324 KB Time limit exceeded
12 Execution timed out 2081 ms 11244 KB Time limit exceeded
13 Execution timed out 2047 ms 12052 KB Time limit exceeded
14 Incorrect 1614 ms 13048 KB Output isn't correct
15 Execution timed out 2098 ms 11916 KB Time limit exceeded
16 Execution timed out 2069 ms 10196 KB Time limit exceeded
17 Execution timed out 2064 ms 13036 KB Time limit exceeded
18 Execution timed out 2075 ms 9932 KB Time limit exceeded
19 Execution timed out 2048 ms 10512 KB Time limit exceeded
20 Execution timed out 2068 ms 10264 KB Time limit exceeded