#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, m, k;
char a[35][35];
vector<string> pwuiz[1001];
vector<string> all1, all2;
void dfs1(int x, int y, string c) {
if(x == n && y == m / 2) {
all1.push_back(c);
return;
}
if(x + 1 <= n) {
dfs1(x + 1, y, c + a[x + 1][y]);
}
if(y + 1 <= m / 2) {
dfs1(x, y + 1, c + a[x][y + 1]);
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cin >> a[i][j];
}
}
cin >> k;
string u = "";
u += a[1][1];
dfs1(1, 1, u);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |