Submission #733830

# Submission time Handle Problem Language Result Execution time Memory
733830 2023-05-01T10:50:11 Z vjudge1 Collecting Mushrooms (NOI18_collectmushrooms) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include<stdlib.h>

using namespace std;

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

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;
      |          ^
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status