Submission #494808

#TimeUsernameProblemLanguageResultExecution timeMemory
494808Christopher_Jetpack (COCI16_jetpack)C++17
80 / 80
14 ms10972 KiB
#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 timeMemoryGrader output
Fetching results...