Muscardinus
드래곤 커브 본문
728x90
https://www.acmicpc.net/problem/15685
#include <iostream>
using namespace std;
int dy[] = { 0,-1,0,1 };
int dx[] = { 1,0,-1,0 };
int map[101][101];
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
int x, y, d, g;
for (int i = 0; i < n; i++) {
int curve[1024] = { 0, };
int curve_size = 0;
cin >> x >> y >> d >> g;
map[y][x] = 1;
curve[curve_size++] = d;
for (int j = 0; j < g; j++) {
for (int k = curve_size-1; k >= 0; k--) {
curve[curve_size++] = (curve[k] + 1) % 4 ;
}
}
for (int j = 0; j < curve_size; j++) {
y += dy[curve[j]];
x += dx[curve[j]];
if (y < 0 || y>=101 || x < 0 || x>=101) continue;
map[y][x] = 1;
}
}
int answer = 0;
for (int y = 0; y < 100; y++) {
for (int x = 0; x < 100; x++) {
if (map[y][x] && map[y][x + 1] && map[y + 1][x] && map[y + 1][x + 1]) {
answer++;
}
}
}
cout << answer<<"\n";
return 0;
}
728x90
Comments