# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
494808 | Christopher_ | Jetpack (COCI16_jetpack) | C++17 | 14 ms | 10972 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 main() {
ios::sync_with_stdio(false);
cin.tie(0);
int m;
cin >> m;
vector<string> g(10);
for (int i = 0; i < 10; ++i) {
cin >> g[i];
}
vector<int> res;
function<bool(int,int)> Dfs = [&](int x, int y) {
if (g[x][y] == 'X') return false;
if (y == m - 1) return true;
g[x][y] = 'X';
if (Dfs(max(0, x - 1), y + 1)) {
res.push_back(y);
return true;
}
if (Dfs(min(9, x + 1), y + 1)) {
return true;
}
return false;
};
if (Dfs(9, 0) == false) {
cout << "0\n";
}
cout << (int) res.size() << '\n';
for (int i = (int) res.size() - 1; ~i; --i) {
cout << res[i] << " 1\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |