QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#270936#7758. PainterEntropy_ReducerRE 0ms0kbC++171.8kb2023-12-01 18:19:442023-12-01 18:19:45

Judging History

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

  • [2023-12-01 18:19:45]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-12-01 18:19:44]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int x, y, r;
    char color;
    int x1, y1, x2, y2;
    vector<vector<int>> col;
    for (int q = 0; q < n; q++)
    {
        string s;
        cin >> s;
        if (s.compare("Circle") == 0)
        {
            cin >> x >> y >> r >> color;
            col.push_back({0, x, y, r, int(color)});
        }
        else if (s.compare("Rectangle") == 0)
        {
            cin >> x1 >> y1 >> x2 >> y2 >> color;
            col.push_back({1, x1, y1, x2, y2, int(color)});
        }
        else if(s.compare("Render") == 0)
        {
            cin >> x1 >> y1 >> x2 >> y2;
            for (int j = y2; j >= y1; j--)
            {
                for (int i = x1; i <= x2; i++)
                {
                    char x = '.';
                    for (int k = col.size() - 1; k >= 0; k--)
                    {
                        if (col[k][0] == 0)
                        {
                            if ((i - col[k][1]) * (i - col[k][1]) + (j - col[k][2]) * (j - col[k][2]) <= col[k][3] * col[k][3])
                            {
                                x = char(col[k][4]);
                                break;
                            }
                        }
                        else
                        {
                            if (i >= col[k][1] && i <= col[k][3] && j >= col[k][2] && j <= col[k][4])
                            {
                                x = char(col[k][5]);
                                break;
                            }
                        }
                    }
                    cout << x;
                }
                cout << endl;
            }
        }
    }
    system("pause > null");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

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: