QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#596472 | #7758. Painter | Sunlight9# | WA | 1ms | 3940kb | C++20 | 2.7kb | 2024-09-28 15:51:19 | 2024-09-28 15:51:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Graph {
int moe;
ll x1, y1;
ll x2, y2;
ll r;
char c;
};
int main() {
cin.tie(nullptr) -> sync_with_stdio(false);
int n;
cin >> n;
vector<Graph> a;
for (int q = 1; q <= n; ++q) {
string op;
cin >> op;
if (op[0] == 'C') {
ll x, y, r;
char c;
cin >> x >> y >> r >> c;
Graph now;
now.moe = 0;
now.x1 = x - r;
now.y1 = y - r;
now.x2 = x + r;
now.y2 = y + r;
now.r = r;
now.c = c;
a.push_back(now);
} else if (op[0] == 'R' && ssize(op) > 6) {
ll x1, y1, x2, y2;
char c;
cin >> x1 >> y1 >> x2 >> y2 >> c;
Graph now;
now.moe = 1;
now.x1 = x1; now.x2 = x2;
now.y1 = y1; now.y2 = y2;
now.r = 0;
now.c = c;
a.push_back(now);
} else {
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
vector ans(x2 - x1 + 10, vector(y2 - y1 + 10, '.'));
for (int j = 0; j <= x2 - x1; ++j) {
for (int k = 0; k <= y2 - y1; ++k) {
int fl = 0;
for (int l = ssize(a) - 1; l >= 0; --l) {
if (fl) break;
if (a[l].moe == 0) {
ll dx = a[l].x1 + a[l].r - (j + x1);
ll dy = a[l].y1 + a[l].r - (k + y1);
if (dx * dx + dy * dy <= a[l].r * a[l].r) {
ans[j][k] = a[l].c;
fl = 1;
break;
}
} else {
ll x = j + x1;
ll y = k + y1;
if (a[l].x1 <= x && x <= a[l].x2 && a[l].y1 <= y && y <= a[l].y2) {
ans[j][k] = a[l].c;
fl = 1;
break;
}
}
}
}
}
for (int j = x2 - x1; j >= 0; --j) {
for (int k = y2 - y1; k >= 0; --k) {
cout << ans[k][j];
}
cout << "\n";
}
}
}
return 0;
}
/*
6
Circle 0 0 5 *
Circle -2 2 1 @
Circle 2 2 1 @
Rectangle 0 -1 0 0 ^
Rectangle -2 -2 2 -2 _
Render -1 0 1 2
*/
/*
2
Rectangle 0 0 2 1 *
Render 0 0 2 2
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
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:
ok 14 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
10 Rectangle -4262 2204 3116 9357 U Circle 7078 6883 4684 W Rectangle 390 675 1195 1251 = Rectangle 78 2138 3288 2570 5 Rectangle -874 797 -99 1440 3 Render 7261 -4311 7304 -4268 Render 2060 9253 2103 9296 Render -1379 -7141 -1336 -7098 Render 982 5708 1025 5751 Render 1080 -9592 1123 -9549
output:
............................................ ............................................ ............................................ ............................................ ............................................ ............................................ .................................
result:
ok 220 lines
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3940kb
input:
10 Rectangle -10000 -10000 10000 10000 @ Rectangle 1197 -1 1198 1 y Rectangle 3684 -1 3685 0 & Circle 8957 0 1 Y Rectangle -5375 0 -5373 2 < Circle 2683 0 0 7 Rectangle 1262 -1 1263 -1 i Circle 3238 0 0 K Circle -3533 0 0 G Render -1605 0 8394 0
output:
result:
wrong answer 1st lines differ - expected: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@', found: ''