QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#268783 | #7758. Painter | ucup-team134# | WA | 1ms | 3776kb | C++20 | 2.9kb | 2023-11-28 21:05:19 | 2023-11-28 21:05:19 |
Judging History
answer
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
typedef pair<int,int> pii;
const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}
const int maxn=2e3+10;
int x[maxn],y[maxn],z[maxn],k[maxn],tip[maxn];
char c[maxn];
string qtp[maxn];
vector<pii>cand;
vector<char>colors;
bool inRect(pii a,int i){
swap(a.ff,a.ss);
a.ff=-a.ff;
if(a.ff<x[i] || a.ff>z[i] || a.ss<y[i] || a.ss>k[i])return false;
return true;
}
bool inCirc(pii a,int i){
swap(a.ff,a.ss);
a.ff=-a.ff;
ll d=((ll)a.ff-x[i])*((ll)a.ff-x[i])+((ll)a.ss-y[i])*((ll)a.ss-y[i]);
ll rr=((ll)z[i])*z[i];
return d<=rr;
}
int main(){
///freopen("test.txt","r",stdin);
int q;
scanf("%d",&q);
for(int i=1;i<=q;i++){
cin>>qtp[i];
if(qtp[i]=="Circle"){
tip[i]=0;
scanf("%d %d %d",&x[i],&y[i],&z[i]);
cin>>c[i];
}
else if(qtp[i]=="Render"){
tip[i]=2;
scanf("%d %d %d %d",&x[i],&y[i],&z[i],&k[i]);
for(int j=x[i];j<=z[i];j++){
for(int p=y[i];p<=k[i];p++){
cand.pb({p,-j});
}
}
}
else if(qtp[i]=="Rectangle"){
tip[i]=1;
scanf("%d %d %d %d",&x[i],&y[i],&z[i],&k[i]);
cin>>c[i];
}
}
sort(cand.begin(),cand.end());
reverse(cand.begin(),cand.end());
cand.resize(unique(cand.begin(),cand.end())-cand.begin());
colors.resize(cand.size());
for(int i=0;i<colors.size();i++)colors[i]=46;
for(int i=1;i<=q;i++){
//printf("%d %d AA\n",i,tip[i]);
if(tip[i]==2){
int pr=-1;
//printf("%d SZ\n",cand.size());
for(int j=0;j<cand.size();j++){
///printf("%d %d XX\n",cand[j].ff,cand[j].ss);
if(inRect(cand[j],i)){
if(pr!=cand[j].ff)printf("\n");
cout<<colors[j];
pr=cand[j].ff;
}
}
printf("\n");
}
if(tip[i]==0){
for(int j=0;j<cand.size();j++){
if(inCirc(cand[j],i)){
colors[j]=c[i];
}
}
}
if(tip[i]==1){
for(int j=0;j<cand.size();j++){
if(inRect(cand[j],i)){
colors[j]=c[i];
}
}
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3776kb
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:
wrong answer 1st lines differ - expected: '.....*.....', found: ''