QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#633716#7758. PainterBai_xiaobo#WA 0ms5076kbC++203.1kb2024-10-12 16:06:332024-10-12 16:06:34

Judging History

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

  • [2024-10-12 16:06:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5076kb
  • [2024-10-12 16:06:33]
  • 提交

answer

#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
#define ll long long
#define endl "\n"
#define int long long
#define pr pair<int,int>
#define x first
#define y second
ll mod=1e9+7;

const ll N=2e3+10;

struct node
{
    string op;
    int q,w,e,r;
    char c;
};

void solve()
{
    ll n;
    cin>>n;
    vector<node> sb;
    map<pr,char> mp;
    for(int i=1;i<=n;i++)
    {
        string a;
        cin>>a;
        if(a=="Circle")
        {
            ll x,y,r;
            char cc;
            cin>>x>>y>>r>>cc;
            node now;
            now.op=a;
            now.q=x;
            now.w=y;
            now.r=r;
            now.c=cc;
            sb.push_back(now);
//            for(int j=x-r;j<=x+r;j++)
//            {
//                for(int k=y-r;k<=y+r;k++)
//                {
//                    if((j-x)*(j-x)+(k-y)*(k-y)<=r*r)
//                    {
//                        mp[{j,k}]=c[0];
//                    }
//                }
//            }
        }
        else if(a=="Rectangle")
        {
            ll x1,y1,x2,y2;
            cin>>x1>>y1>>x2>>y2;
            char cc;
            cin>>cc;
            node now;
            now.op=a;
            now.q=x1;
            now.w=y1;
            now.e=x2;
            now.r=y2;
            now.c=cc;
            sb.push_back(now);
//            for(int j=x1;j<=x2;j++)
//            {
//                for(int k=y1;k<=y2;k++)
//                {
//                    mp[{j,k}]=c[0];
//
//                }
//            }
        }
        else
        {
            ll x1,y1,x2,y2;
            cin>>x1>>y1>>x2>>y2;
            node now;
            now.op=a;
            now.q=x1;
            now.w=y1;
            now.e=x2;
            now.r=y2;
            sb.push_back(now);
            for(int j=y2;j>=y1;j--)
            {
                for(int k=x1;k<=x2;k++)
                {
                    mp[{j,k}]='.';
                }
            }
        }
    }
    for(auto now : sb)
    {
        if(now.op=="Circle")
        {
            for(auto [u,p] : mp)
            {
                auto [x,y]=u;
                if((x-now.q)*(x-now.q)+(y-now.w)*(y-now.w)<=now.r*now.r) mp[{x,y}]=now.c;
            }
        }
        else if(now.op=="Rectangle")
        {
            for(auto [u,p] : mp)
            {
                auto [x,y]=u;
                if(x>=now.q&&x<=now.e&&y>=now.w&&y<=now.r) mp[{x,y}]=now.c;
            }
        }
        else
        {
            for(int j=now.r;j>=now.w;j--)
            {
                for(int k=now.q;k<=now.e;k++)
                {
                    cout<<mp[{k,j}];
                }
                cout<<endl;
            }
        }
    }
}

/*
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
 */

signed main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

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
Wrong Answer
time: 0ms
memory: 5076kb

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:

wrong answer 1st lines differ - expected: '............................................', found: ''