Submission #572690

# Submission time Handle Problem Language Result Execution time Memory
572690 2022-06-05T04:49:12 Z Devigo Collecting Mushrooms (NOI18_collectmushrooms) C++14
60 / 100
2000 ms 5352 KB
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

const int siz = 0;
const int mod = 0;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int r, c, d, k;
	cin >> r >> c >> d >> k;
	vector<string> v(r);
	for(int i=0; i<r; i++) {
		cin >> v[i];
	}
	//for(int i=0; i<r; i++) {
	//	for(int j=0; j<c; j++) {
	//		cout << v[i][j] << " ";
	//	}
	//	cout << "\n";
	//}
	vector<vector<int>> cnt(r,vector<int>(c,0));
	for(int i=0; i<r; i++) {
		for(int j=0; j<c; j++) {
			if(v[i][j] == 'S') {
				int x,y,z,e; //cout << "c\n";
				x = max(0,i-d);
				y = max(0,j-d);
				z = min(r-1,i+d);
				e = min(c-1,j+d);
				for(int sp=x; sp<=z; sp++) {
					for(int ep=y; ep<=e; ep++) {
						cnt[sp][ep]++;
					}
				}
			}
		}
	}
	//for(int i=0; i<r; i++) {
	//	for(int j=0; j<c; j++) {
	//		cout << cnt[i][j] << " ";
	//	}
	//	cout << endl;
	//}
	int cn = 0;
	for(int i=0; i<r; i++) {
		for(int j=0; j<c; j++) {
			if(v[i][j] == 'M' && cnt[i][j] >= k) cn++;
		}
	}
	cout << cn << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 376 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 376 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 38 ms 376 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1480 KB Output is correct
2 Correct 30 ms 1536 KB Output is correct
3 Correct 8 ms 1716 KB Output is correct
4 Correct 49 ms 1560 KB Output is correct
5 Correct 2 ms 1552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2080 ms 5352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 376 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 38 ms 376 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 316 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 9 ms 1480 KB Output is correct
17 Correct 30 ms 1536 KB Output is correct
18 Correct 8 ms 1716 KB Output is correct
19 Correct 49 ms 1560 KB Output is correct
20 Correct 2 ms 1552 KB Output is correct
21 Execution timed out 2080 ms 5352 KB Time limit exceeded
22 Halted 0 ms 0 KB -