# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
648336 | Trisanu_Das | Jetpack (COCI16_jetpack) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
vector<int>res;
char tab[20][100010];
int n;
int dfs(int l,int c){
if(tab[l][c]=='X')return 0;
if(c==n-1)return 1;
tab[l][c]='X';
if(dfs(min(9,l+1),c+1) == 1) return 1;
else if(dfs(max(0,l-1),c+1) == 1){
res.push_back(c);
return 1;
}
return 0;
}
int main(){
cin >> n;
for(int i=0;i<10;i++) cin >> tab[i];
dfs(9,0);
reverse(res.begin(),res.end());
cout << res.size << '\n';
for(int i = 0;i < res.size(); i++) cout << res[i] << ' ' << 1 << '\n';;
return 0;
}