Pagini recente »
Istoria paginii utilizator/ancaiordanescu
|
Borderou de evaluare (job #804559)
|
Istoria paginii utilizator/carape
|
Istoria paginii utilizator/zieno_b
|
Cod sursă (job #357050)
Cod sursă (job
#357050)
#include <bits/stdc++.h>
using namespace std;
#define nmax 501
#define nmax2 250001
int n;
struct {
bitset<nmax> data[nmax];
} matrix[2];
#define maxdir 6
int x_dir[] = {0, 1, 1, 0, -1, -1};
int y_dir[] = {-1, -1, 0, 1, 1, 0};
inline bool check_bounds(int x, int y) {
return x > 0 && y > 0 && x < n && y < n;
}
int main() {
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
scanf("%d", &n);
int n2 = n * n;
for (int i = 0, x, y; i < n2; i++) {
scanf("%d%d", &x, &y);
matrix[i % 2].data[x][y] = true;
for (int j = 0; j < maxdir; j++) {
int new_x = x + x_dir[j];
int new_y = y + y_dir[j];
if (check_bounds(new_x, new_y) && matrix[i % 2].data[new_x][new_y]) {
}
}
}
for (int i =1; i <= n; i++ )
{
for (int j = 1; j <= n; j++) {
cout << matrix[0].data[i][j] << " ";
}cout << endl;
}
for (int i =1; i <= n; i++ )
{
for (int j = 1; j <= n; j++) {
cout << matrix[1].data[i][j] << " ";
}cout << endl;
}
return 0;
}