# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
883804 |
2023-12-06T05:43:34 Z |
vjudge1 |
Emacs (COCI20_emacs) |
C++17 |
|
1 ms |
604 KB |
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
const int lim=2e5+100;
#else
const int lim=2e3+100;
#endif
#include "bits/stdc++.h"
using namespace std;
//#define int long long
#define pb push_back
const int mod=1e9+7;
using pii=pair<int,int>;
inline void solve(){
int n,m;
cin>>n>>m;
string s[n];
for(int i=0;i<n;i++){
cin>>s[i];
}
set<int>vis;
int ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(s[i][j]=='*'&&!vis.count(i*m+j)){
ans++;
int l=i;
for(;;){
if(l<n&&s[l][j]=='*'){
l++;
}else{
break;
}
}
int r=j;
for(;;){
if(r<m&&s[i][r]=='*'){
r++;
}else{
break;
}
}
for(int ll=i;ll<l;ll++){
for(int rr=j;rr<r;rr++){
vis.insert(ll*m+rr);
}
}
}
}
}
cout<<ans<<"\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#else
//freopen("grass.in","r",stdin);
//freopen("grass.out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |