Submission #733829

#TimeUsernameProblemLanguageResultExecution timeMemory
733829vjudge1Collecting Mushrooms (NOI18_collectmushrooms)C++17
9 / 100
776 ms3376 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...