# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333342 | JovanK26 | Jetpack (COCI16_jetpack) | C++14 | 16 ms | 5104 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;
int n;
char mat[10][100001];
vector<int> v;
bool dfs(int x,int y)
{
if(mat[x][y]=='X')return 0;
if(y==n-1)return 1;
mat[x][y]='X';
if(dfs(min(9,x+1),y+1))return 1;
if(dfs(max(0,x-1),y+1))
{
v.push_back(y);
return 1;
}
return 0;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i=0;i<10;i++)
{
cin >> mat[i];
}
dfs(9,0);
reverse(v.begin(),v.end());
cout << v.size()<<'\n';
for(int i=0;i<v.size();i++)
{
cout << v[i]<<' '<<1<<'\n';
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |