Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: anonymous
Problemset: หุ่นพัง
Language: cpp
Time: 0.002 second
Submitted On: 2026-11-04 22:02:40
#include <bits/stdc++.h>
using namespace std;
int ans = 0;
vector<string> num;
void sol(int x,int y){
queue<pair<int,int>> q;
q.emplace(x,y);
num[x][y] = 'X';
while(!q.empty()){
auto [a,b] = q.front();
ans++;
q.pop();
if(a-1 >= 0 && num[a-1][b] == '.'){
num[a-1][b] = 'X';
q.emplace(a-1,b);
}
if(b-1 >= 0 && num[a][b-1] == '.'){
num[a][b-1] = 'X';
q.emplace(a,b-1);
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n;cin >> n;
for(int i=0;i<n;i++){
string u;cin >> u;
num.push_back(u);
}
sol(n-1,n-1);
cout << ans;
}