From Albert Campbell C.I.
About
include <bits/stdc++.h>
using namespace std; long long n; char a;int x;int y; bool f[100][100]; int main() {
cin >> n;
for (int j=10;j>=1;j--)
for (int i=1;i<=n;i++)
{
cin >> a;
if (a=='.') f[i][j]=true; else f[i][j]=false;
};
vector <pair<int,int> > queuee;
queuee.push_back(make_pair(1,1));
vector<vector<int> > queuee_bam;
vector<int> queuee_thoigian;
queuee_thoigian.push_back(0);
queuee_bam.push_back(queuee_thoigian);
queuee_thoigian[0]=1;
long long k=0;
while (queuee[0].first!=n)
{
x=queuee[0].first;
y=queuee[0].second;
if (y==1 && f[x+1][y]==true)
{
queuee.push_back(make_pair(x+1,y));
queuee_bam.push_back(queuee_bam[k]);
};
if (2*queuee_bam[k][0]+1==queuee_bam[k].size())
{
if (f[x+1][y+1]==true)
{
queuee.push_back(make_pair(x+1,y+1));
queuee_bam[k][0]++;
queuee_bam[k].push_back(x);
queuee_bam.push_back(queuee_bam[k]);
queuee_bam[k][0]--; queuee_bam[k].pop_back();
};
if (y!=1 && f[x+1][y-1]==true)
{
queuee.push_back(make_pair(x+1,y-1));
queuee_bam.push_back(queuee_bam[k]);
};
} else
{
if (f[x+1][y+1]==true)
{
queuee.push_back(make_pair(x+1,y+1));
queuee_bam.push_back(queuee_bam[k]);
};
if (y!=1 && f[x+1][y-1]==true)
{
queuee.push_back(make_pair(x+1,y-1));
int t=queuee_bam[k][queuee_bam[k].size()-1];
queuee_bam[k].push_back(x-t);
queuee_bam.push_back(queuee_bam[k]);
};
};
vector<pair<int,int> >::iterator p=queuee.begin();
vector<pair<int,int> >::iterator p1=queuee.begin();
p1++;
queuee.erase(p,p1);
k++;
};
for (int i=0;i<=queuee_bam[k].size()-1;i++)
cout << queuee_bam[k][i]<<" ";
if (queuee_bam[k].size()%2==0) cout << n-queuee_bam[k][queuee_bam[k].size()-1];
return 0;
}