#include <bits/stdc++.h>
using namespace std;
int m, n, leaves, a[30][150000];
char t[30][50000];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> m >> n;
for (int k = 1; k <= n; k++) {
int i, j;
cin >> i >> j;
a[i][j] = 1;
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= i << (m - 1); j++) {
if (a[i][j] == 1) {
a[i + 1][j * 2 - 1] = a[i + 1][j * 2] = 1;
}
}
}
leaves = 1 << (m - 1);
t[m][1] = 'o';
leaves--;
int fla = 0, k = 1;
while (leaves--) {
if (fla) {
k += 2;
t[m][k] = 'o';
} else {
k += 4;
t[m][k] = 'o';
}
fla = !fla;
}
int fir = 0, nxt = 0;
for (int i = m - 1; i >= 1; i--) {
for (int j = 1; j <= k + 1; j++) {
if (fir && nxt) {
t[i][(fir + nxt) / 2] = 'o';
fir = 0;
nxt = 0;
}
if (fir == 0 && t[i + 1][j] == 'o') {
fir = j;
} else if (t[i + 1][j] == 'o') {
nxt = j;
}
}
}
for (int i = 1; i <= m; i++) {
int cnt = 0;
string c(k + 10, char(32));
for (int j = 1; j <= k; j++) {
if (t[i][j] == 'o') {
cnt++;
if (a[i][cnt] == 1) {
cout << char(32);
} else {
cout << "o";
if (!a[i + 1][cnt * 2 - 1])
c[j - 1] = '/';
if (!a[i + 1][cnt * 2])
c[j + 1] = '\\';
}
} else {
cout << char(32);
}
}
if (i == m)
break;
fla = 0;
while (1) {
string c2(k + 10, char(32));
cout << "\n";
for (int j = 1; j <= k; j++)
cout << c[j];
for (int j = 1; j <= k; j++) {
if ((t[i + 1][j - 1] == 'o' && c[j] == '/') || (t[i + 1][j + 1] == 'o' && c[j] == '\\')) {
fla = 1;
break;
}
if (c[j] == '/') {
c2[j - 1] = '/';
} else if (c[j] == '\\') {
c2[j + 1] = '\\';
}
}
c = c2;
if (fla)
break;
}
cout << "\n";
}
return 0;
}
https://www.luogu.com.cn/record/164443910