QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#519107 | #7758. Painter | WendyChen | WA | 0ms | 3724kb | C++20 | 1.9kb | 2024-08-14 16:22:57 | 2024-08-14 16:22:58 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f3f3f3f3f
#define pb push_back
const int mod = 1e9 + 7;
const int N = 1e6 + 50;
//<< fixed << setprecision(1)
using namespace std;
int n;
int cnt = 0;
struct NODE {
string s;
int x1, x2, y1, y2;
int r;
char ss;
}node[2010];
void solve() {
cin >> n;
for (int i = 1; i <= n; ++i) {
string s;
cin >> s;
if (s == "Circle") {
int x, y, r;
cin >> x >> y >> r;
char ss;
cin >> ss;
cnt++;
node[cnt].s = s;
node[cnt].x1 = x;
node[cnt].y1 = y;
node[cnt].r = r;
node[cnt].ss = ss;
}
else if (s == "Rectangle") {
int x1, y1, x2, y2;
cnt++;
cin >> x1 >> y1 >> x2 >> y2;
char ss;
cin >> ss;
node[cnt].s = s;
node[cnt].x1 = x1;
node[cnt].y1 = y1;
node[cnt].x2 = x2;
node[cnt].y2 = y2;
node[cnt].ss = ss;
}
else if (s == "Render") {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int q = y2; q >= y1; --q) {
for (int p = x1; p >= x2; ++p){
int flog = 0;
for (int k = cnt; k >= 1; --k) {
if (node[k].s == "Circle") {
if ((p - node[k].x1) * (p - node[k].x1) + (q - node[k].y1) * (q - node[k].y1) <= node[k].r * node[k].r) {
cout << node[k].ss;
flog = 1;
break;
}
}
else {
if (p >= node[k].x1 && p <= node[k].x2 && q >= node[k].y1 && q <= node[k].y2) {
cout << node[k].ss;
flog = 1;
break;
}
}
}
if (flog == 0) {
cout << ".";
}
}
cout << endl;
}
}
}
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T = 1;
//cin >> T;
while (T--) {
solve();
}
}
/*
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
*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3724kb
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: ''