#include "Azzurro.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> Azzurro(int n, int l, std::string s) {
int p = 0;
vector<vector<int>> ans(0);
while(s.size() <= 50) {
s+='A';
}
for(int i = 0; i < n; i++) {
ans.push_back(vector<int> (8));
}
for(int i = 0; i <= 14; i++) {
int br = 0;
bool yeah = true;
if(i == 0 || i == 14) {
yeah = false;
}
for(int j = 0; j < n; j++) {
int x = j,y = i-j;
if(y >= 0 && y < n) {
if(yeah) {
yeah = false;
}
else {
int c = 0;
if(s[p] == 'B') {
c = 1;
}
ans[x][y] = c;
p++;
}
}
}
}
for(int i = 1; i < 14; i++) {
int x,y,br = 0;
if(i <= 7) {
x = 0;
y = i;
}
else {
x = i-7;
y = 7;
}
int a = x,b = y;
while(a < n && b >= 0) {
br+=ans[a][b];
a+=2;
b-=2;
}
ans[x][y] = br%2;
}
return ans;
}
#include "Bordeaux.h"
#include<bits/stdc++.h>
using namespace std;
std::string Bordeaux(int n, int l, std::vector<std::vector<int>> t) {
string ans = "",s = "";
if(t[0][0]) {
s+='A';
}
else {
s+='B';
}
int px = 0,py = 0;
bool yeah[n][n];
for(int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) {
yeah[i][j] = false;
}
}
for(int i = 1; i < 14; i++) {
int x,y,br = 0;
if(i <= 7) {
x = 0;
y = i;
}
else {
x = i-7;
y = 7;
}
int a = x,b = y;
while(a < n && b >= 0) {
yeah[a][b] = true;
br+=t[a][b];
a+=2;
b-=2;
}
if(br%2) {
if(py < 7 && yeah[px][py+1]) {
py++;
}
else {
px++;
}
}
else {
if(py < 7 && !yeah[px][py+1]) {
py++;
}
else {
px++;
}
}
t[px][py] = 1-t[px][py];
bool idk = true;
for(int j = 0; j < n; j++) {
int x = j,y = i-j;
if(y >= 0 && y < 8) {
if(idk) {
idk = false;
}
else {
if(t[x][y]) {
s+='B';
}
else {
s+='A';
}
}
}
}
}
if(t[7][7]) {
s+='A';
}
else {
s+='B';
}
for(int i = 0; i < l; i++) {
ans+=s[i];
}
return ans;
}