#include #include #include using namespace std; int findLDiag(int posX, int posY); int findPDiag(int posX, int posY); bool neniNula(int x); int X, Y; vector sloupce, radky, lDiag, pDiag; int main() { int nQueens, i, j, posX, posY, volne; cin >> X >> Y >> nQueens; while(X!=0){ //cout << "X: " << X << endl; radky.clear(); sloupce.clear(); lDiag.clear(); pDiag.clear(); radky.resize(X, 1); sloupce.resize(Y, 1); lDiag.resize(X+Y-1, 1); pDiag.resize(X+Y-1, 1); // nacitani pozic a vyskrtavani radku/sloupcu/diagonal for(i=0; i> posX >> posY; radky[posX-1] = 0; sloupce[posY-1] = 0; lDiag[findLDiag(posX-1, posY-1)] = 0; pDiag[findPDiag(posX-1, posY-1)] = 0; } /* for(i=0; i> X >> Y >> nQueens; } return 0; } int findLDiag(int posX, int posY) { return Y-1-posY + posX; } int findPDiag(int posX, int posY) { return posX + posY; } bool neniNula(int x) { return x!=0; }