QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#260680#7758. Paintersmartyi#RE 3ms101332kbC++203.0kb2023-11-22 14:11:442023-11-22 14:11:45

Judging History

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

  • [2023-11-22 14:11:45]
  • 评测
  • 测评结果:RE
  • 用时:3ms
  • 内存:101332kb
  • [2023-11-22 14:11:44]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define int long long
using namespace std;
const int INF = 1e9;
const int N = 1e4 + 10;
const double eps = 1e-9;
int n, m;
int a[N];
struct node {
    string s;
    int a, b, c, d;
    char ch;
};
char pt[N][N];
signed main() {
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            pt[i][j] = '.';
        }
    }
    int l = 1e9 + 10, r = -1e9 - 10, u = -1e9 - 10, p = 1e9 + 10;
    cin >> n;
    vector<node> v;
    string s, ch;
    int a, b, c, d;
    for (int i = 1; i <= n; i++) {
        cin >> s;
        if (s == "Circle") {
            cin >> a >> b >> c;
            l = min(l, a - c);
            r = max(r, a + c);
            u = max(u, b + c);
            p = min(p, b - c);
            cin >> ch;
            node x;
            x.s = s;
            x.a = a;
            x.b = b;
            x.c = c;
            x.ch = ch[0];
            v.push_back(x);
        } else if (s == "Rectangle") {
            cin >> a >> b >> c >> d;
            l = min({l, a, c});
            r = max({r, a, c});
            u = max({u, b, d});
            p = min({p, b, d});
            cin >> ch;
            node x;
            x.s = s;
            x.a = a;
            x.b = b;
            x.c = c;
            x.d = d;
            x.ch = ch[0];
            v.push_back(x);
        } else {
            cin >> a >> b >> c >> d;
            l = min({l, a, c});
            r = max({r, a, c});
            u = max({u, b, d});
            p = min({p, b, d});
            node x;
            x.s = s;
            x.a = a;
            x.b = b;
            x.c = c;
            x.d = d;
            x.ch = ch[0];
            v.push_back(x);
        }
    }
    for (auto i : v) {
        if (i.s == "Circle") {
            for (int x = i.a - i.c; x <= i.a + i.c; x++) {
                for (int y = i.b - i.c; y <= i.b + i.c; y++) {
                    if ((x - i.a) * (x - i.a) + (y - i.b) * (y - i.b) <= i.c * i.c) {
                        pt[x - l][y - p] = i.ch;
                    }
                }
            }
        } else if (i.s == "Rectangle") {
            for (int x = i.a; x <= i.c; x++) {
                for (int y = i.b; y <= i.d; y++) {
                    pt[x - l][y - p] = i.ch;
                }
            }
        } else {
            for (int y = i.d; y >= i.b; y--) {
                for (int x = i.a; x <= i.c; x++) {
                    cout << pt[x - l][y - p];
                }
                cout << endl;
            }
        }
    }
}

// #include <iostream>
// #include <algorithm>
// #include <vector>
// #include <map>
// #define int long long
// using namespace std;
// const int INF = 1e9;
// const int N = 1e6 + 10;
// int n, m;
// int a[1111],b[1111];
// signed main() {
//     cin>>n;
//     for(int i=1;i<=n;i++) cin>>a[i];
//     for(int i=1;i<=n;i++) cin>>b[i];

// }

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 101332kb

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
Runtime Error

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: