QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#633486 | #7758. Painter | Bai_xiaobo# | TL | 0ms | 3596kb | C++20 | 1.8kb | 2024-10-12 15:34:41 | 2024-10-12 15:34:41 |
Judging History
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;
void solve()
{
ll n;
cin>>n;
map<pr,char>mp;
for(int i=1;i<=n;i++)
{
string a;
cin>>a;
if(a=="Circle")
{
ll x,y,r;
string c;
cin>>x>>y>>r>>c;
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;
string c;
cin>>c;
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;
for(int j=y2;j>=y1;j--)
{
for(int k=x1;k<=x2;k++)
{
if(!mp[{k,j}])
cout<<'.';
else
cout<<mp[{k,j}];
}
cout<<'\n';
}
}
}
}
/*
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: 3596kb
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