QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#627190#7758. Painteryixuanoct#WA 2ms3544kbC++141.7kb2024-10-10 15:09:312024-10-10 15:09:31

Judging History

This is the latest submission verdict.

  • [2024-10-10 15:09:31]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3544kb
  • [2024-10-10 15:09:31]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

struct cmd {
    string op;
    ll x, y, r, s;
    char c;
};

vector<cmd> v;

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    ll n;cin >> n;
    for (ll i = 1; i <= n; i++) {
        string op;cin >> op;
        if (op == "Circle") {
            ll x, y, r;cin >> x >> y >> r;
            char c;cin >> c;
            cmd tmp;
            tmp.op = op;tmp.x = x, tmp.y = y, tmp.r = r, tmp.c = c;
            v.push_back(tmp);
        }
        else if (op == "Rectangle") {
            ll x1, y1, x2, y2;cin >> x1 >> y1 >> x2 >> y2;
            char c;cin >> c;
            cmd tmp;
            tmp.op = op;tmp.x = x1, tmp.y = y1, tmp.r = x2, tmp.s = y2, tmp.c = c;
            v.push_back(tmp);
        }
        else if (op == "Render") {
            ll x1, y1, x2, y2;cin >> x1 >> y1 >> x2 >> y2;
            for (ll j = y2; j >= y1; j--) {
                for (ll i = x2; i >= x1; i--) {
                    char ans = '.';
                    for (auto t : v) {
                        string op = t.op;
                        ll x = t.x, y = t.y, r = t.r, s = t.s;
                        char c = t.c;
                        if (op == "Circle") {
                            if ((i - x) * (i - x) + (j - y) * (j - y) <= r * r) ans = c;
                        }
                        else if (op == "Rectangle") {
                            if (x <= i && i <= r && y <= j && j <= s) ans = c;
                        }
                    }
                    cout << ans;
                }
                cout << endl;
            }
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3540kb

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: 3496kb

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: 2ms
memory: 3544kb

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: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'