QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#519216 | #7758. Painter | LuCiiiD# | WA | 0ms | 3644kb | C++23 | 2.3kb | 2024-08-14 17:30:44 | 2024-08-14 17:30:44 |
Judging History
answer
#include <bits/stdc++.h>
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define int long long
#define inf 4e18
#define MAX 10005
using namespace std;
int N, x1, yy1, x2, y2, r;
char maze[MAX][MAX];
char color;
string ope;
vector<array<int, 6>> OPE;
void draw_Circle(int x, int y, int r, int X1, int Y1, int X2, int Y2, char ch)
{
int XX = X1, YY = Y1;
X1 = max(X1, x - r), Y1 = max(Y1, y - r), X2 = min(X2, x + r), Y2 = min(Y2, y + r);
for (int i = X1; i <= X2; i++)
{
for (int j = Y1; j <= Y2; j++)
{
if ((i - x) * (i - x) + (j - y) * (j - y) <= r * r)
maze[i - XX][j - YY] = ch;
}
}
return;
}
void draw_Rectangle(int x1, int y1, int x2, int y2, int X1, int Y1, int X2, int Y2, char ch)
{
int XX = X1, YY = Y1;
X1 = max(X1, x1), Y1 = max(Y1, y1), X2 = min(X2, x2), Y2 = min(Y2, y2);
for (int i = X1; i <= X2; i++)
{
for (int j = Y1; j <= Y2; j++)
{
maze[i - XX][j - YY] = ch;
}
}
}
signed main()
{
_11037_
cin >> N;
while (N--)
{
cin >> ope;
if (ope == "Circle")
cin >> yy1 >> x1 >> r >> color, OPE.push_back({0, x1, yy1, r, 0, color});
else if (ope == "Rectangle")
cin >> yy1 >> x1 >> y2 >> x2 >> color, OPE.push_back({1, x1, yy1, x2, y2, color});
else
{
cin >> yy1 >> x1 >> y2 >> x2;
for (int i = x1; i <= x2; i++)
for (int j = yy1; j <= y2; j++)
maze[i - x1][j - yy1] = (char)(46);
for (auto [op, x_1, y_1, x_2, y_2, ch] : OPE)
{
if (op == 0)
draw_Circle(x_1, y_1, x_2, x1, yy1, x2, y2, ch);
else if (op = 1)
draw_Rectangle(x_1, y_1, x_2, y_2, x1, yy1, x2, y2, ch);
}
for (int i = x1; i <= x2; i++)
{
for (int j = y2; j >= yy1; j--)
cout << maze[i - x1][j - yy1];
cout << endl;
}
}
}
}
/*
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
*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3644kb
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:
.....*..... ..*******.. .*********. .**_____**. .****^****. *****^***** .**@***@**. .*@@@*@@@*. .**@***@**. ..*******.. .....*..... *^* *** @*@
result:
wrong answer 3rd lines differ - expected: '.**@***@**.', found: '.*********.'