QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#535734 | #7758. Painter | shabi666 | TL | 0ms | 3552kb | C++20 | 1.5kb | 2024-08-28 14:03:33 | 2024-08-28 14:03:33 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
// #define int long long
#define x first
#define y second
#define pb push_back
using namespace std;
typedef pair<int, int> PII;
void solve() {
map<PII, char> mp;
int n;
cin >> n;
while (n--) {
string s;
cin >> s;
if (s == "Circle") {
int x, y, r;
char col;
cin >> x >> y >> r >> col;
for (int i = x - r; i <= x + r; i++) {
for (int j = y - r; j <= y + r; j++) {
if ( (x - i) * (x - i) + (y - j) * (y - j) <= r * r ) mp[{i, j}] = col;
}
}
} else if (s == "Rectangle") {
int x1, y1, x2, y2;
char col;
cin >> x1 >> y1 >> x2 >> y2 >> col;
for (int i = x1; i <= x2; i++) {
for (int j = y1; j <= y2; j++) {
mp[{i, j}] = col;
}
}
} else if (s == "Render") {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int j = y2; j >= y1; j--) {
for (int i = x1; i <= x2; i++) {
if ( mp.count({i, j}) ) cout << mp[{i, j}];
else cout << '.';
}
cout << endl;
}
}
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
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: -100
Time Limit Exceeded
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