QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706725#7758. PainterAshbourneWA 0ms3868kbC++231.3kb2024-11-03 13:08:292024-11-03 13:08:31

Judging History

你现在查看的是最新测评结果

  • [2024-11-03 13:08:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2024-11-03 13:08:29]
  • 提交

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: '. . . . . * . . . . .'