#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pli> vli;
typedef vector<pil> vil;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int oo = 1000000007;
const int MX = 100001;
const ld PI = 4 * atan((ld)1);
int n;
vi res;
char grid[11][MX];
bool dfs(int u, int v) {
if (grid[u][v] == 'X') return false;
if (v == n) return true;
grid[u][v] = 'X';
if (dfs(max(1, u - 1), v + 1)) { res.pb(v); return true; }
if (dfs(min(10, u + 1), v + 1)) return true;
}
void solve() {
cin >> n;
for (int i = 1; i <= 10; i++) for (int j = 1; j <= n; j++) cin >> grid[i][j];
if (!dfs(10, 1)) { cout << 0; return; }
reverse(all(res)); cout << sz(res) << endl;
for (auto it : res) cout << it << " 1\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
solve();
return 0;
}
Compilation message
jetpack.cpp: In function 'bool dfs(int, int)':
jetpack.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
47 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Crashed with an obstacle |
2 |
Incorrect |
1 ms |
332 KB |
Crashed with an obstacle |
3 |
Incorrect |
1 ms |
332 KB |
Crashed with an obstacle |
4 |
Incorrect |
1 ms |
332 KB |
Crashed with an obstacle |
5 |
Incorrect |
1 ms |
332 KB |
Crashed with an obstacle |
6 |
Incorrect |
1 ms |
460 KB |
Crashed with an obstacle |
7 |
Incorrect |
3 ms |
720 KB |
Crashed with an obstacle |
8 |
Incorrect |
6 ms |
1228 KB |
Crashed with an obstacle |
9 |
Incorrect |
9 ms |
1744 KB |
Crashed with an obstacle |
10 |
Incorrect |
11 ms |
2228 KB |
Crashed with an obstacle |