QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#535734#7758. Paintershabi666TL 0ms3552kbC++201.5kb2024-08-28 14:03:332024-08-28 14:03:33

Judging History

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

  • [2024-08-28 14:03:33]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3552kb
  • [2024-08-28 14:03:33]
  • 提交

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

output:


result: