QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#646360 | #7758. Painter | Tomgao4116 | TL | 0ms | 3556kb | C++14 | 1.3kb | 2024-10-16 22:26:58 | 2024-10-16 22:26:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> pll;
typedef double db;
map<pll,char> mp;
map<pll,ll> cnt;
struct node{
ll x;
ll y;
ll r;
char c;
ll ti;
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int n;
cin>>n;
vector<node> ss;
for(int i=1;i<=n;i++){
string s;
cin>>s;
ll x,y,r;
char c;
ll x0,x2,y0,y2;
if(s[0]=='C'){
// cout<<"s1: "<<endl;
cin>>x>>y>>r>>c;
ss.push_back({x,y,r,c,i});
}else if(s[0]=='R'&&s[2]=='c'){
// cout<<"s2: "<<endl;
cin>>x0>>y0>>x2>>y2>>c;
for(int j=y2;j>=y0;j--){
for(int k=x0;k<=x2;k++){
mp[{j,k}]=c;
cnt[{j,k}]=i;
}
}
}else{
// cout<<"s3: "<<endl;
cin>>x0>>y0>>x2>>y2;
for(int j=y2;j>=y0;j--){
for(int k=x0;k<=x2;k++){
char tt;
ll t1=0,t2=0;
for(auto u:ss){
if((j-u.y)*(j-u.y)+(k-u.x)*(k-u.x)<=u.r*u.r){
t1=u.ti;
tt=u.c;
}
}
if(t1>cnt[{j,k}]){
mp[{j,k}]=tt;
cnt[{j,k}]=t1;
cout<<mp[{j,k}];
}else{
if(mp[{j,k}]>=33&&mp[{j,k}]<=126){
cout<<mp[{j,k}];
}else{
mp[{j,k}]='.';
cout<<'.';
}
}
}
cout<<'\n';
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
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
Time Limit Exceeded
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