Submission #733935

# Submission time Handle Problem Language Result Execution time Memory
733935 2023-05-01T12:12:15 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
60 / 100
253 ms 3664 KB
#include<bits/stdc++.h>

using namespace std;

char ch[5001][5001];
int d,k,p=0;
int  h[5001][5001];




void range(int a , int b){
	int i,j,l=0;
	for( i=a-d ; i<=a+d ; i++){
		for(j=b-d ; j<=b+d ; j++){
			if(ch[i][j] == 'M'){ 
				h[i][j]+=1;
			}
		}
	}
	return;
}




int main(){
	int  r, c ,i,j;
	cin>>r>>c>>d>>k;
	for(i=1 ; i<=r ; i++){
		for(j=1 ; j<=c ; j++){
			cin>>ch[i][j];
		}
	}
	for(i=1 ; i<=r ; i++){
		for(j=1 ; j<=c ;j++){
			if(ch[i][j] == 'S'){
				range( i , j );
			}
		}
	}
	for(i=1 ; i<=r ; i++){
		for(j=1 ; j<=c ;j++){
			if(h[i][j]>=k){
				p++;
			}
		}
	}
	cout<<p;

return 0;
}

Compilation message

mushrooms.cpp: In function 'void range(int, int)':
mushrooms.cpp:13:10: warning: unused variable 'l' [-Wunused-variable]
   13 |  int i,j,l=0;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 304 KB Output is correct
2 Correct 151 ms 1096 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
5 Correct 1 ms 816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 304 KB Output is correct
2 Correct 151 ms 1096 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
5 Correct 1 ms 816 KB Output is correct
6 Correct 10 ms 696 KB Output is correct
7 Correct 29 ms 340 KB Output is correct
8 Correct 253 ms 1156 KB Output is correct
9 Correct 15 ms 852 KB Output is correct
10 Correct 2 ms 432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 724 KB Output is correct
2 Correct 1 ms 824 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 3464 KB Output is correct
2 Correct 79 ms 3236 KB Output is correct
3 Correct 24 ms 3664 KB Output is correct
4 Correct 188 ms 3532 KB Output is correct
5 Correct 14 ms 3284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 29 ms 1732 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 304 KB Output is correct
2 Correct 151 ms 1096 KB Output is correct
3 Correct 1 ms 1108 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
5 Correct 1 ms 816 KB Output is correct
6 Correct 10 ms 696 KB Output is correct
7 Correct 29 ms 340 KB Output is correct
8 Correct 253 ms 1156 KB Output is correct
9 Correct 15 ms 852 KB Output is correct
10 Correct 2 ms 432 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 824 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 1 ms 724 KB Output is correct
15 Correct 1 ms 696 KB Output is correct
16 Correct 39 ms 3464 KB Output is correct
17 Correct 79 ms 3236 KB Output is correct
18 Correct 24 ms 3664 KB Output is correct
19 Correct 188 ms 3532 KB Output is correct
20 Correct 14 ms 3284 KB Output is correct
21 Runtime error 29 ms 1732 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -