# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
952180 | penguinma | Jetpack (COCI16_jetpack) | C++17 | 50 ms | 6356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |