# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731008 | vjudge1 | Emacs (COCI20_emacs) | C++17 | 1 ms | 468 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |