QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#262113 | #7758. Painter | proven# | WA | 0ms | 3608kb | C++11 | 2.1kb | 2023-11-23 15:39:03 | 2023-11-23 15:39:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
struct node {
string s;
int ax,ay,bx,by;
char c;
};
void solve() {
int n;cin >> n;
vector<node> op(n + 1);
for(int i = 1;i <= n;i++) {
cin >> op[i].s;
if(op[i].s == "Circle") {
cin >> op[i].ax >> op[i].ay >> op[i].bx >> op[i].c;
}
else if(op[i].s == "Rectangle") {
cin >> op[i].ax >> op[i].ay >> op[i].bx >> op[i].by >> op[i].c;
}
else {
cin >> op[i].ax >> op[i].ay >> op[i].bx >> op[i].by;
}
}
for(int i = 1;i <= n;i++) {
if(op[i].s == "Render") {
int x = op[i].bx - op[i].ax + 1;
int y = op[i].by - op[i].ay + 1;
vector<vector<char> > ma(y,vector<char> (x + 1));
for(auto &X : ma) {
for(auto &Y : X) {
Y = '.';
}
}
for(int j = op[i].by;j >= op[i].ay;j--) {
for(int k = op[i].ax;k <= op[i].bx;k++) {
for(int u = 1;u <= i;u++) {
if(op[u].s != "Render") {
if(op[u].s == "Circle" && ((k - op[u].ax) * (k - op[u].ax) + (j - op[u].ay) * (j - op[u].ay) <= op[u].bx * op[u].bx)) {
ma[op[i].by - j][k - op[i].ax] = op[u].c;
}
if(op[u].s == "Rectangle" && ((k >= op[u].ax && k <= op[u].bx && j >= op[u].ay && j <= op[u].by))) {
ma[op[i].by - j][k - op[i].ax] = op[u].c;
}
}
}
}
}
for(auto &X : ma) {
for(auto &Y : X) {
cout << Y;
}
cout << endl;
}
}
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
// cin >> T;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
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: '.....*......'