#include <iostream> #include <vector> using namespace std; bool mp[101][101] = {false}; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; bool isValid(int x, int y) { return x >= 0 && x <= 100 && y >= 0 && y <= 100; } pair<int, int> turn(pair<int, int> o, pair<int, int>& p) { cout << "o" << o.first << "," << o.second << endl; cout << "p" << p.first << "," << p.second << endl; auto c = make_pair(p.first-o.first, p.second-o.second); cout << "c" << c.first << "," << c.second << endl; cout << "r" << o.first-c.second << "," << o.second+c.first << endl << endl; return make_pair(o.first-c.second, o.second+c.first); } void func(int x, int y, int d, int g) { vector<pair<int, int>> v; v.push_back({x, y}); v.push_back({x+dx[d], y+dy[d]}); while(g--) { auto o = v.back(); for(int i = v.size()-2; i >= 0; i--) v.push_back(turn(o, v[i])); } for(auto& p : v) { cout << p.first << "," << p.second << endl; if(isValid(p.first, p.second)) mp[p.second][p.first] = true; } cout << endl; } int check() { int result = 0; for(int y = 0; y < 100; y++) { for(int x = 0; x < 100; x++) if(mp[y][x] && mp[y+1][x] && mp[y][x+1] && mp[y+1][x+1]) { result++; cout << x <<","<< y << endl; } } return result; } int main() { int t; cin >> t; while(t--) { int x, y, d, g; cin >> x >> y >> d >> g; func(x, 100-y, d, g); } cout << check(); return 0; }
3 3 3 0 1 4 2 1 3 4 2 2 1
o4,97 p3,97 c-1,0 r4,96 3,97 4,97 4,96 o4,99 p4,98 c0,-1 r5,99 o5,99 p4,99 c-1,0 r5,98 o5,99 p4,98 c-1,-1 r6,98 o6,98 p5,98 c-1,0 r6,97 o6,98 p5,99 c-1,1 r5,97 o6,98 p4,99 c-2,1 r5,96 o6,98 p4,98 c-2,0 r6,96 4,98 4,99 5,99 5,98 6,98 6,97 5,97 5,96 6,96 o3,98 p4,98 c1,0 r3,99 4,98 3,98 3,99 4,96 5,96 3,97 4,97 5,97 3,98 4,98 7