Submission #731008

#TimeUsernameProblemLanguageResultExecution timeMemory
731008vjudge1Emacs (COCI20_emacs)C++17
50 / 50
1 ms468 KiB
//Test case unutma ve reset //Sinirlari kontrol et #include <bits/stdc++.h> using namespace std; #define int long long #define mod 1e9+7 #define OYY 1e12 #define ordu ios_base::sync_with_stdio(false);cin.tie(NULL); #define mid (start+end)/2 int vis[105][105]; char dizi[105][105]; int n,m; void dfs(int i,int j){ vis[i][j]=1; if(i+1<n && vis[i+1][j]==0){ if(dizi[i+1][j]=='*'){ dfs(i+1,j); } } if(j+1<m && vis[i][j+1]==0){ if(dizi[i][j+1]=='*'){ dfs(i,j+1); } } if(i-1>=0 && vis[i-1][j]==0){ if(dizi[i-1][j]=='*'){ dfs(i-1,j); } } if(j-1>=0 && vis[i][j-1]==0){ if(dizi[i][j-1]=='*'){ dfs(i,j-1); } } return ; } int32_t main(){ ordu cin>>n>>m; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>dizi[i][j]; } } int cev=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(dizi[i][j]=='*' && vis[i][j]==0){ cev++; dfs(i,j); } } } cout<<cev<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...