QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519102#7758. Painterqqbb#WA 90ms164096kbC++203.1kb2024-08-14 16:21:192024-08-14 16:21:19

Judging History

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

  • [2024-08-14 16:21:19]
  • 评测
  • 测评结果:WA
  • 用时:90ms
  • 内存:164096kb
  • [2024-08-14 16:21:19]
  • 提交

answer

#include <bits/stdc++.h>
#define qqbb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
#define int long long
#define endl '\n'
#define lb(x) x & -x
#define AA cerr<<"AA"<<endl;
using namespace std;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;

const int N = 2e5 + 10, M = 4e5 + 10;

void solve(){
    int n;cin>>n;
    vector<array<char,2>> op(n+1);
    vector<array<int,4>> opp(n+1);
    int lo=inf,le=inf;
    int lo1=inf,le1=inf;
    int hi1=-inf,ri1=-inf;
    for(int i=1;i<=n;i++){
        string s;cin>>s;
        if(s == "Circle"){
            int x,y,r;cin>>x>>y>>r;
            char p;cin>>p;
            lo=min(lo,y-r);
            le=min(le,x-r);
            op[i][0] = 'A';
            op[i][1] = p;
            opp[i][0]=x;
            opp[i][1]=y;
            opp[i][2]=r;
            opp[i][3]=0;
        }
        else if(s == "Rectangle"){
            int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
            char p;cin>>p;
            lo=min(lo,y1);
            le=min(le,x1);
            op[i][0] = 'B';
            op[i][1] = p;
            opp[i][0]=x1;
            opp[i][1]=y1;
            opp[i][2]=x2;
            opp[i][3]=y2;
        }
        else{
            int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
            lo1=min(lo1,y1);
            le1=min(le1,x1);
            hi1=max(hi1,y2);
            ri1=max(ri1,x2);
            op[i][0] = 'C';
            op[i][1] = '.';
            opp[i][0]=x1;
            opp[i][1]=y1;
            opp[i][2]=x2;
            opp[i][3]=y2;
        }
    }
    vector<vector<char>> mp(ri1 - le1 + 1,vector<char> (hi1 - lo1 + 1));
    int mpx = ri1 - le1 + 1;
    int mpy = hi1 - lo1 + 1;
    for(int i=0;i<mpx;i++){
        for(int j=0;j<mpy;j++){
            mp[i][j] = '.';
        }
    }
    for(int i=1;i<=n;i++){
        if(op[i][0] == 'A'){
            int u=opp[i][0]-le;
            int v=opp[i][1]-lo;
            int r=opp[i][2];
            for(int x=u-r;x<=min(mpx-1,u+r);x++){
                for(int y=v-r;y<=min(mpy-1,v+r);y++){
                    if((x-u)*(x-u) + (y-v)*(y-v) <= r*r){
                        mp[x][y] = op[i][1];
                    }
                }
            }
        }
        else if(op[i][0] == 'B'){
            int x1=opp[i][0]-le;
            int y1=opp[i][1]-lo;
            int x2=opp[i][2]-le;
            int y2=opp[i][3]-lo;
            for(int x=x1;x<=min(mpx-1,x2);x++){
                for(int y=y1;y<=min(mpy-1,y2);y++){
                    mp[x][y] = op[i][1];
                }
            }
        }
        else{
            int x1=opp[i][0]-le1;
            int y1=opp[i][1]-lo1;
            int x2=opp[i][2]-le1;
            int y2=opp[i][3]-lo1;
            for(int y=y2;y>=y1;y--){
                for(int x=x1;x<=x2;x++){
                    cout<<mp[x][y];
                }
                cout<<endl;
            }
        }
    }
}

signed main(){
    qqbb;
//	cout<<fixed<<setprecision(0);
    int Test=1;
//	cin>>Test;
    while(Test--){
        solve();
    }
    return 0;
}

詳細信息

Test #1:

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

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: 90ms
memory: 164096kb

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:

WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW...

result:

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