QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#498405 | #7758. Painter | MCdyc | WA | 1ms | 3904kb | C++20 | 2.3kb | 2024-07-30 13:43:25 | 2024-07-30 13:43:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(), a.end()
struct info
{
int op;
int x1;
int y1;
int x2;
int y2;
int r;
char c;
};
void solve();
void out(int x1, int y1, int x2, int y2);
vector<info> a;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int test = 1;
// cin >> test;
while (test--)
{
solve();
}
return 0;
}
void solve()
{
int n;
cin >> n;
while (n--)
{
string str;
cin >> str;
if (str[2] == 'n')
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
out(x1, y1, x2, y2);
}
else if (str[2] == 'r')
{
int x, y, r;
string c;
cin >> x >> y >> r >> c;
a.push_back({1, x, y, 0, 0, r, c[0]});
}
else
{
int x1, y1, x2, y2;
string c;
cin >> x1 >> y1 >> x2 >> y2 >> c;
a.push_back({2, x1, y1, x2, y2, 0, c[0]});
}
}
}
void out(int x1, int y1, int x2, int y2)
{
vector<vector<char>> g(x2 - x1 + 5, vector<char>(y2 - y1 + 5));
for (int i = x1; i <= x2; i++)
{
for (int j = y1; j <= y2; j++)
{
g[i - x1][j - y1] = '.';
}
}
for (int k = 0; k < a.size(); k++)
{
if (a[k].op == 1)
{
for (int i = x1; i <= x2; i++)
{
for (int j = y1; j <= y2; j++)
{
if ((a[k].x1 - i) * (a[k].x1 - i) + (a[k].y1 - j) * (a[k].y1 - j) <= a[k].r * a[k].r)
g[i - x1][j - y1] = a[k].c;
}
}
}
else
{
for (int i = x1; i <= x2; i++)
{
for (int j = y1; j <= y2; j++)
{
if (a[k].x1 <= i && i <= a[k].x2 && a[k].y1 <= j && j <= a[k].y2)
g[i - x1][j - y1] = a[k].c;
}
}
}
}
for (int j = y2; j >= y1; j--)
{
for (int i = x1; i <= x2; i++)
{
cout << g[i - x1][j - y1];
}
cout << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
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: 3756kb
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: 0
Accepted
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:
ok single line: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
10 Rectangle -8228 -3399 3061 5167 P Circle 600 -5480 5406 b Rectangle -5644 -7645 -2592 2164 & Circle 5101 -2822 5474 ~ Rectangle -116 -2676 326 5228 X Rectangle -3772 1494 -3354 3523 ! Rectangle 2084 -729 2467 1390 ; Circle -786 900 658 3 Rectangle -290 514 436 662 g Render -7140 -4510 -7140 5489
output:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
result:
ok 10000 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 Render 4431 -6882 4486 -6880 Circle -5131 -3627 3919 K Rectangle 3708 -7820 7499 -3207 c Render 1734 4783 1752 4818 Circle 94 4899 1950 ' Render 8154 6624 8159 6862 Circle 3837 550 356 0 Render 2230 -2196 2232 -1293 Rectangle -935 701 949 1318 ? Render 5282 -7624 5997 -7624
output:
........................................................ ........................................................ ........................................................ ................... ................... ................... ................... ................... ................... ............
result:
ok 1183 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 Render -6920 -3210 -6633 -3205 Circle 5221 3077 390 F Render -6294 -8386 -6235 -8360 Circle 65 -687 1867 ] Render 1017 -8804 1689 -8803 Circle 475 1359 2114 ) Rectangle 52 -1984 1779 -614 M Rectangle 1506 -2131 2992 -871 g Render -6910 7316 -6904 7371 Render 8670 -8136 8684 -8117
output:
................................................................................................................................................................................................................................................................................................ ..............
result:
ok 111 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
10 Rectangle 310990349 810289642 815443779 836759585 ; Rectangle 793346907 -272571666 797309793 172290221 ] Rectangle 467935431 -439130559 544524486 229621852 3 Rectangle -224358535 -197178831 393287874 348972387 s Rectangle -150003927 9534824 -107643143 77085794 j Render -883072967 590805088 -88307...
output:
............................................ ............................................ ............................................ ............................................ ............................................ ............................................ .................................
result:
ok 220 lines
Test #8:
score: -100
Wrong Answer
time: 1ms
memory: 3856kb
input:
10 Rectangle -1000000000 -1000000000 1000000000 1000000000 @ Rectangle 666424716 -2 666424717 -1 6 Circle 755891297 0 0 1 Rectangle -361127769 -2 -361127769 -2 I Circle -136039484 0 2 R Circle 728693826 0 0 2 Circle 973790054 0 1 : Rectangle -15797858 0 -15797857 1 n Circle -524847486 0 1 F Render 4...
output:
F:F@F:FF@F:F2FF@F:F2FFRF:F2F::F:F2F::F2F:FR:F2F:FR:F2F:F@FF:F:F2FF:F1F:FF:F@F:FF:FRF:FR@F:F2FRRF:F2F:RF:F2F:FF:F@F:FF2F:FRFF2F:F1FF2F:F2F:2F:F2F::F@F:F2:FRF:FRFFRF:FRFF2F:F@FF:F2F:FF:F2F:F2:F@F:F22FRF:F22F:F2F:2F:F2F:FF:F2F:FFRF2F:FFRF:FRF:2F:F@F:2F:F@F::F2FRF::F@F:F2FFRF:F2FFRF:F2FF:F2F2FF:F2F:FR:F...
result:
wrong answer 1st lines differ - expected: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@', found: 'F:F@F:FF@F:F2FF@F:F2FFRF:F2F::...:F2F:F2:F2F:F22F:F1F22F:F1F:FF:'