Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: 9drxwz
Problemset: หุ่นพัง
Language: cpp
Time: 0.890 second
Submitted On: 2026-03-04 22:43:25
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<vector<int>> map(n,vector<int>(n));
for(int i=0;i<n;i++){
string x;
cin>>x;
for(int j=0;j<n;j++){
map[i][j]=x[j];
}
}
int end=n-1;
stack<pair<int,int>> s;
int sum=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(map[i][j]=='.'){
s.push({i,j});
bool bruh = false;
while(!s.empty()){
int x = s.top().first;
int y = s.top().second;
s.pop();
if(x+1 < n && map[x+1][y]=='.'){
s.push({x+1,y});
}
if(y+1 < n && map[x][y+1]=='.'){
s.push({x,y+1});
}
if(x==n-1 && y==n-1){
bruh = true;
}
}
if(bruh) sum++;
}
}
}
cout<<sum;
}