QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#596336 | #7758. Painter | Sunlight9# | WA | 1ms | 3904kb | C++20 | 4.7kb | 2024-09-28 15:33:24 | 2024-09-28 15:33:26 |
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 i = 0; i < ssize(a); ++i) {
// if ((x1 <= a[i].x1 && y1 <= a[i].y1) || (a[i].x2 <= x2 && a[i].y2 <= y2) || ()) {
if (a[i].moe == 0) {
ll x = a[i].x1 + a[i].r;
ll y = a[i].y1 + a[i].r;
ll r = a[i].r;
// cerr << x << " " << y << " yuanxin\n";
x -= x1;
y -= y1;
// cerr << x << " " << y << " yuanxin\n";
ll cnt = 0, num = 0;
for (int j = max(x - r, 0LL); j <= min(x + r, x2 - x1); ++j) {
cnt = abs(j - x);
num = sqrt(r * r - cnt * cnt);
if (0 <= j && j <= x2 - x1) {
for (int k = max(y - num, 0LL); k <= min(y + num, y2 - y1); ++k) {
ans[j][k] = a[i].c;
}
}
}
// ll cnt = 0;
// ll num = r;
// for (int j = x; j <= min(x + r, x2 - x1); ++j) {
// if (0 <= j && j <= x2 - x1) {
// for (int k = max(y - num, 0LL); k <= min(y + num, y2 - y1); ++k) {
// // cerr << k << " nowk\n";
// ans[j][k] = a[i].c;
// }
// }
// cnt++;
// num = sqrt(r * r - cnt * cnt);
// }
// cnt = 1;
// num = sqrt(r * r - cnt * cnt);
// for (int j = x - 1; j >= max(x - r, 0LL); --j) {
// if (0 <= j && j <= x2 - x1) {
// for (int k = max(y - num, 0LL); k <= min(y + num, y2 - y1); ++k) {
// ans[j][k] = a[i].c;
// }
// }
// cnt++;
// num = sqrt(r * r - cnt * cnt);
// }
} else {
for (int j = max(0LL, a[i].x1 - x1); j <= min(x2 - x1, a[i].x2 - x1); ++j) {
for (int k = max(0LL, a[i].y1 - y1); k <= min(y2 - y1, a[i].y2 - y1); ++k) {
ans[j][k] = a[i].c;
}
}
}
// for (int j = 0; j <= x2 - x1; ++j) {
// for (int k = 0; k <= y2 - y1; ++k) {
// cout << ans[j][k];
// }
// cout << "\n";
// }
// cout << "\n";
// }
// cout << a[i].x1 << " " << a[i].y1 << " " << a[i].x2 << " " << a[i].y2 << "\n";
}
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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
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: 0ms
memory: 3576kb
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: 3904kb
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: ''