QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#270476#7758. Painterucup-team139WA 149ms36996kbC++231.7kb2023-11-30 22:04:512023-11-30 22:04:51

Judging History

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

  • [2023-11-30 22:04:51]
  • 评测
  • 测评结果:WA
  • 用时:149ms
  • 内存:36996kb
  • [2023-11-30 22:04:51]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

void solve(int t){
    int n;
    cin>>n;
    
    map<pair<long long,long long>,char> f;
    vector<string> op(n);
    vector<char> col(n);
    vector<long long> x1(n),y1(n),x2(n),y2(n),r(n);
    
    for(int i=0;i<n;i++){
        cin>>op[i];
        
        if(op[i]=="Circle"){
            cin>>x1[i]>>y1[i]>>r[i]>>col[i];
        }else if(op[i]=="Rectangle"){
            cin>>x1[i]>>y1[i]>>x2[i]>>y2[i]>>col[i];
        }else{
            cin>>x1[i]>>y1[i]>>x2[i]>>y2[i];
            
            for(int j=y2[i];j>=x1[i];j--){
                for(int k=x1[i];k<=x2[i];k++){
                    f[{k,j}]='.';
                }
            }
        }
    }
    
    for(int i=0;i<n;i++){
        if(op[i]=="Circle"){
            
            for(auto &[coord,val] : f){
                auto [x,y] = coord;
                if((x-x1[i])*(x-x1[i])+(y-y1[i])*(y-y1[i])<=r[i]*r[i]){
                    val = col[i];
                }
            }
            
        }else if(op[i]=="Rectangle"){
            
            for(auto &[coord,val] : f){
                auto [x,y] = coord;
                if(x>=x1[i] && x<=x2[i] && y>=y1[i] && y<=y2[i]){
                    val = col[i];
                }
            }
            
        }else{
            
            for(int j=y2[i];j>=y1[i];j--){
                for(int k=x1[i];k<=x2[i];k++){
                    cout<<f[{k,j}];
                }
                cout<<"\n";
            }
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++)solve(i);
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 149ms
memory: 36996kb

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