답안 #131237

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131237 2019-07-16T20:40:43 Z FedericoS Collecting Mushrooms (NOI18_collectmushrooms) C++14
100 / 100
79 ms 27640 KB
#include <iostream>
#include <cstring>
using namespace std;

int R,C,D,K;
int ans;

int main(){

	cin>>R>>C>>D>>K;
	char A[R+10][C+10];
	int M[R+10][C+10];

	memset(A, 0, sizeof A);
	memset(M, 0, sizeof M);

	for(int i=1;i<R+1;i++)
		for(int j=1;j<C+1;j++)
			cin>>A[i][j];

	for(int i=1;i<R+2;i++)
		for(int j=1;j<C+2;j++)
			M[i][j]=(A[i][j]=='S')+M[i-1][j]+M[i][j-1]-M[i-1][j-1];

	for(int i=1;i<R+1;i++)
		for(int j=1;j<C+1;j++)
			if(A[i][j]=='M')
				ans+=K<=(M[min(R+1,i+D)][min(C+1,j+D)]-M[max(0,i-D-1)][min(C+1,j+D)]-M[min(R+1,i+D)][max(0,j-D-1)]+M[max(0,i-D-1)][max(0,j-D-1)]);

	cout<<ans;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 1528 KB Output is correct
2 Correct 23 ms 1528 KB Output is correct
3 Correct 28 ms 1784 KB Output is correct
4 Correct 23 ms 1532 KB Output is correct
5 Correct 26 ms 1656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 27512 KB Output is correct
2 Correct 77 ms 27640 KB Output is correct
3 Correct 78 ms 27512 KB Output is correct
4 Correct 77 ms 27508 KB Output is correct
5 Correct 79 ms 27516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 22 ms 1528 KB Output is correct
17 Correct 23 ms 1528 KB Output is correct
18 Correct 28 ms 1784 KB Output is correct
19 Correct 23 ms 1532 KB Output is correct
20 Correct 26 ms 1656 KB Output is correct
21 Correct 77 ms 27512 KB Output is correct
22 Correct 77 ms 27640 KB Output is correct
23 Correct 78 ms 27512 KB Output is correct
24 Correct 77 ms 27508 KB Output is correct
25 Correct 79 ms 27516 KB Output is correct
26 Correct 57 ms 4376 KB Output is correct
27 Correct 56 ms 3416 KB Output is correct
28 Correct 56 ms 3896 KB Output is correct
29 Correct 55 ms 3832 KB Output is correct
30 Correct 61 ms 3960 KB Output is correct