QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706725 | #7758. Painter | Ashbourne | WA | 0ms | 3868kb | C++23 | 1.3kb | 2024-11-03 13:08:29 | 2024-11-03 13:08:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct Shape {
int x1, y1, x2, y2, r;
int type;
public:
char col;
Shape(int x, int y, int r, char c) : x1(x), y1(y), r(r), col(c) {
type = 0;
}
Shape(int x1, int y1, int x2, int y2, char c) : x1(x1), y1(y1), x2(x2), y2(y2), col(c) {
type = 1;
}
bool inside(int x, int y) {
if (type) return x1 <= x && x <= x2 && y1 <= y && y <= y2;
return (__int128)(x-x1)*(x-x1) + (__int128)(y-y1)*(y-y1) <= (__int128)r*r;
}
};
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
vector<Shape> a;
for (; n; n--) {
string tp;
cin >> tp;
if (tp[0] == 'C') {
int x, y, r; char col;
cin >> x >> y >> r >> col;
a.push_back({x, y, r, col});
} else if (tp[2] == 'c') {
int x1, y1, x2, y2; char col;
cin >> x1 >> y1 >> x2 >> y2 >> col;
a.push_back({x1, y1, x2, y2, col});
} else {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int y = y2; y >= y1; y--) {
for (int x = x1; x <= x2; x++) {
bool flag = false;
for (auto it = a.rbegin(); it != a.rend(); it++) {
if (it->inside(x, y)) {
cout << it->col;
flag = true;
break;
}
}
if (!flag) cout << '.';
cout << " \n"[x == x2];
}
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3868kb
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 1st lines differ - expected: '.....*.....', found: '. . . . . * . . . . .'