QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#261036 | #7758. Painter | SSH# | WA | 1ms | 3860kb | C++17 | 1.8kb | 2023-11-22 17:30:31 | 2023-11-22 17:30:31 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve();
signed main(){
cin.sync_with_stdio(0);
cin.tie(0);
int T = 1;
//cin >> T;
while(T--){
solve();
}
return 0;
}
void solve(){
int n,a,b,c,d;
int x1,x2,y1,y2;
int tx1,tx2,ty1,ty2,r;
char e,tag;
string s;
cin >> n;
vector<array<int,6>> v;
for(int i = 1;i <= n;i ++) {
cin >> s;
if(s == "Circle") {
cin >> a >> b >> c >> e;
v.push_back({0,a,b,c,(int)e,0});
} else if(s == "Rectangle") {
cin >> a >> b >> c >> d >> e;
v.push_back({1,a,b,c,d,(int)e});
} else {
cin >> x1 >> y1 >> x2 >> y2;
vector<vector<char>> out(x2 - x1 + 1,vector<char>(y2 - y1 + 1, '.'));
for(int x = x1;x <= x2;x ++) {
for(int y = y1;y <= y2;y ++) {
for(auto [id,a,b,c,d,e] : v) {
if(id == 0) {
tx1 = a,ty1 = b,r = c,tag = (char)d;
if((x - tx1)*(x - tx1) + (y - ty1)*(y - ty1) <= r * r) {
out[x-x1][y-y1] = tag;
}
} else {
tx1 = a,ty1 = b,tx2 = c,ty2 = d,tag = (char)e;
if(x>=tx1&&x<=tx2&&y>=ty1&&y<=ty2){
out[x-x1][y-y1] = tag;
}
}
}
}
}
for(int i = x2 - x1;i >= 0;i --) {
for(int j = 0;j <= y2 - y1;j ++) {
cout << out[j][i];
}
cout << endl;
}
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3488kb
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: 3772kb
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: 0ms
memory: 3860kb
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: ''