# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
559537 | kappa | Jetpack (COCI16_jetpack) | C++14 | 1071 ms | 4964 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;
typedef long long ll;
#define pb push_back
#define st first
#define nd second
#define MOD 1000000007
typedef pair<ll, ll> pii;
const ll maxn = 1e5 + 5;
vector<int> ans;
char d[15][maxn];
int n;
int dfs(int x, int y){
if(x < 0 || x >= 10 || y < 0 || y >= n){
return 0;
}
if(d[x][y] == 'X'){
return 0;
}
if(y == n-1){
return 1;
}
if(dfs(min(9, x+1), y + 1)){
return 1;
}
if(dfs(max(0, x-1), y + 1)){
ans.pb(y);
return 1;
}
return 0;
}
int main(){
cin >> n;
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < n; i++)
{
cin >> d[j][i];
}
}
dfs(9, 0);
reverse(ans.begin(), ans.end());
cout << ans.size() << "\n";
for(auto i : ans){
cout << i << " 1\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |