# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
952180 | penguinma | Jetpack (COCI16_jetpack) | C++17 | 50 ms | 6356 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.
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll n;
vector<vector<char>>a;
vector<ll>v;
ll dfs(ll x,ll y)
{
if(a[x][y]=='X')
return 0;
if(y==n-1)
return 1;
a[x][y]='X';
if(dfs(min((ll)9,x+1),y+1)==1)
return 1;
if(dfs(max((ll)0,x-1),y+1)==1)
{
v.push_back(y);
return 1;
}
return 0;
}
int main()
{
cin>>n;
a.assign(10,vector<char>(n));
for(ll i=0;i<10;i++)
{
for(ll j=0;j<n;j++)
cin>>a[i][j];
}
dfs(9,0);
reverse(v.begin(),v.end());
cout<<v.size()<<"\n";
for(auto i:v)
cout<<i<<" "<<1<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |