QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#747427 | #7758. Painter | 1926406757 | WA | 1ms | 3916kb | C++20 | 2.3kb | 2024-11-14 17:09:24 | 2024-11-14 17:09:25 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct cir
{
int x,y,r;
char col;
};
struct rec
{
int x1,y1,x2,y2;
char col;
};
signed main(void)
{
int n;
cin >> n;
vector<cir> ci(n+1);
vector<rec> re(n+1);
vector<int> fi(n+1);
for(int i=1;i<=n;++i)
{
string op;
cin >> op;
if(op == "Circle")
{
cin >> ci[i].x >> ci[i].y >> ci[i].r >> ci[i].col;
fi[i] = 1;
}
else if(op == "Rectangle")
{
cin >> re[i].x1 >> re[i].y1 >> re[i].x2 >> re[i].y2 >> re[i].col;
fi[i] = 2;
}
else
{
int x1,y1,x2,y2;
cin >> x1 >> y1 >> x2 >> y2;
int lenx = x2 - x1 + 1, leny = y2 - y1 + 1;
vector<vector<char>> a(lenx+2,vector<char>(leny+2,'.'));
for(int j=1;j<i;++j)
{
if(fi[j] == 1)
{
for(int x = 0;x<lenx;++x)
{
for(int y=0;y<leny;++y)
{
// cout << x1+x << ' ' << y1+y << '\n';
if( ((x1+x)-ci[j].x)*((x1+x)-ci[j].x) + ((y1+y)-ci[j].y)*((y1+y)-ci[j].y) <= ci[j].r*ci[j].r)
{
a[x][y] = ci[j].col;
}
}
}
}
else if(fi[j] == 2)
{
for(int x=0;x<lenx;++x)
{
for(int y=0;y<leny;++y)
{
if( x1+x >= re[j].x1 && x1+x <= re[j].x2 && y1+y >= re[j].y1 && y1+y <= re[j].y2)
{
a[x][y] = re[j].col;
}
}
}
}
}
for(int x=lenx-1;x>=0;--x)
{
for(int y=leny-1;y>=0;--y)
{
cout << a[y][x];
}
puts("");
}
fi[i] = 3;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
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: 3580kb
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: 3916kb
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: ''