QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#270936 | #7758. Painter | Entropy_Reducer | RE | 0ms | 0kb | C++17 | 1.8kb | 2023-12-01 18:19:44 | 2023-12-01 18:19:45 |
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int x, y, r;
char color;
int x1, y1, x2, y2;
vector<vector<int>> col;
for (int q = 0; q < n; q++)
{
string s;
cin >> s;
if (s.compare("Circle") == 0)
{
cin >> x >> y >> r >> color;
col.push_back({0, x, y, r, int(color)});
}
else if (s.compare("Rectangle") == 0)
{
cin >> x1 >> y1 >> x2 >> y2 >> color;
col.push_back({1, x1, y1, x2, y2, int(color)});
}
else if(s.compare("Render") == 0)
{
cin >> x1 >> y1 >> x2 >> y2;
for (int j = y2; j >= y1; j--)
{
for (int i = x1; i <= x2; i++)
{
char x = '.';
for (int k = col.size() - 1; k >= 0; k--)
{
if (col[k][0] == 0)
{
if ((i - col[k][1]) * (i - col[k][1]) + (j - col[k][2]) * (j - col[k][2]) <= col[k][3] * col[k][3])
{
x = char(col[k][4]);
break;
}
}
else
{
if (i >= col[k][1] && i <= col[k][3] && j >= col[k][2] && j <= col[k][4])
{
x = char(col[k][5]);
break;
}
}
}
cout << x;
}
cout << endl;
}
}
}
system("pause > null");
return 0;
}
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
7 Circle 0 0 5 * Circle -2 2 1 @ Circle 2 2 1 @ Rectangle 0 -1 0 0 ^ Rectangle -2 -2 2 -2 _ Render -5 -5 5 5 Render -1 0 1 2
output:
.....*..... ..*******.. .**@***@**. .*@@@*@@@*. .**@***@**. *****^***** .****^****. .**_____**. .*********. ..*******.. .....*..... @*@ *** *^*