#include <bits/stdc++.h>
using namespace std;
int n, g, d, bd[101][101];
int dr[4] = { 0, -1, 0, 1 };
int dc[4] = { 1, 0, -1, 0 };
void evol(vector<pair<int, int>>& dots) {
pair<int, int> p = dots.back();
for (int idx = dots.size() - 2; idx >= 0; idx--) {
pair<int, int> tmp = make_pair(-p.second+dots[idx].second + p.first,
p.first - dots[idx].first + p.second);
dots.push_back(tmp);
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
memset(bd, 0, sizeof(bd));
cin >> n;
for (int i = 0; i < n; i++) {
vector<pair<int, int>> dots;
int x, y;
cin >> x >> y >> d >> g;
dots.push_back(make_pair(y, x));
dots.push_back(make_pair(y + dr[d], x + dc[d]));
while (g--)
evol(dots);
for (auto a : dots)
bd[a.first][a.second] = 1;
}
int ret = 0;
for (int r = 0; r < 100; r++) for (int c = 0; c < 100; c++) {
if (bd[r][c] && bd[r + 1][c] && bd[r][c + 1] && bd[r + 1][c + 1])
ret += 1;
}
cout << ret << "\n";
}
댓글남기기