Submission #952180

#TimeUsernameProblemLanguageResultExecution timeMemory
952180penguinmaJetpack (COCI16_jetpack)C++17
80 / 80
50 ms6356 KiB
#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 timeMemoryGrader output
Fetching results...