QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263063 | #7758. Painter | cscnk52# | WA | 1ms | 3396kb | C++17 | 1.6kb | 2023-11-24 14:49:20 | 2023-11-24 14:49:21 |
Judging History
answer
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define ff cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
using namespace std;
struct XINXI {
int op;
int x, y, r;
int x1, x2, y1, y2;
char col;
};
signed main() {
int n;
cin >> n;
vector<XINXI> vec;
for (int m = 1; m <= n; m++) {
string s;
cin >> s;
int op;
if (s == "Circle") {
op = 1;
int mid_x, mid_y, r;
char col;
cin >> mid_x >> mid_y >> r >> col;
XINXI cnt;
cnt.op = op, cnt.x = mid_x, cnt.y = mid_y, cnt.col = col, cnt.r = r;
vec.push_back(cnt);
} else if (s == "Rectangle") {
op = 2;
int x1, y1, x2, y2;
char col;
cin >> x1 >> y1 >> x2 >> y2 >> col;
XINXI cnt;
cnt.op = op, cnt.x1 = x1, cnt.y1 = y1, cnt.x2 = x2, cnt.y2 = y2, cnt.col = col;
vec.push_back(cnt);
} else if (s == "Render") {
int xx1, yy1, xx2, yy2;
cin >> xx1 >> yy1 >> xx2 >> yy2;
int sz = vec.size();
for (int j = yy2; j >= yy1; j--) {
for (int i = xx2; i >= xx1; i--) {
int flag = 0;
for (int k = sz - 1; k >= 0; k--) {
if (vec[k].op == 1) {
if ((i - vec[k].x) * (i - vec[k].x) + (j - vec[k].y) * (j - vec[k].y) <= vec[k].r * vec[k].r) {
cout << vec[k].col;
flag = 1;
break;
}
} else {
if (i >= vec[k].x1 && i <= vec[k].x2 && j >= vec[k].y1 && j <= vec[k].y2) {
cout << vec[k].col;
flag = 1;
break;
}
}
}
if (flag == 0) cout << ".";
}
cout << endl;
}
cout << endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3396kb
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 12th lines differ - expected: '@*@', found: ''