Submission #733829

# Submission time Handle Problem Language Result Execution time Memory
733829 2023-05-01T10:48:10 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
9 / 100
776 ms 3376 KB
#include<bits/stdc++.h>
#include<stdlib.h>

using namespace std;

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

void range(int a , int b){
	int i,j,s;
	s=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(ch[i][j] == 'S'){
				range( i , j );
			}
		}
	}
	
	
	for(i=1 ; i<=r ; i++){
		for(j=1 ; j<=c ;j++){
			if(h[i][j] >= k){
//				cout<<h[i][j]<<endl;
//				system("pause");
				p++;
			}
		}
	}
	
	cout<<p;

return 0;
}

Compilation message

mushrooms.cpp: In function 'void range(int, int)':
mushrooms.cpp:11:10: warning: variable 's' set but not used [-Wunused-but-set-variable]
   11 |  int i,j,s;
      |          ^
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 413 ms 1076 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 13 ms 572 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 413 ms 1076 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 13 ms 572 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 32 ms 676 KB Output is correct
7 Correct 93 ms 372 KB Output is correct
8 Incorrect 776 ms 1144 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 99 ms 3376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 31 ms 1532 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 413 ms 1076 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 13 ms 572 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Correct 32 ms 676 KB Output is correct
7 Correct 93 ms 372 KB Output is correct
8 Incorrect 776 ms 1144 KB Output isn't correct
9 Halted 0 ms 0 KB -