QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#628824 | #7755. Game on a Forest | cyc_43346 | TL | 0ms | 0kb | C++20 | 2.4kb | 2024-10-10 22:35:52 | 2024-10-10 22:35:52 |
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int read()
{
int res = 0;
int x = 1;
char ch = getchar();
while(ch < '0' || ch < '9')
{
if(ch == '-')
{
x = -1;
}
ch = getchar();
}
while(ch >= '0' && ch <= '9')
{
res = res * 10 + ch - '0';
ch = getchar();
}
return res * x;
}
const int N = 2e3 + 9;
int n;
int a[N];
ll x[N] , y[N] , r[N] , Rx1[N] , Rx2[N] , Ry1[N] , Ry2[N];
char col[N];
bool check1(ll tx , ll ty , int now)
{
if((x[now] - tx) * (x[now] - tx) + (y[now] - ty) * (y[now] - ty) <= r[now] * r[now])
{
return true;
}
return false;
}
bool check2(ll tx , ll ty , int now)
{
if(Rx1[now] <= tx && tx <= Rx2[now] && Ry1[now] <= ty && ty <= Ry2[now])
{
return true;
}
return false;
}
void solve()
{
string s;
cin >> n;
for(int i = 1 ; i <= n ; i++)
{
cin >> s;
if(s == "Circle")
{
a[i] = 1;
cin >> x[i] >> y[i] >> r[i] >> col[i];
}
else if(s == "Rectangle")
{
a[i] = 2;
cin >> Rx1[i] >> Ry1[i] >> Rx2[i] >> Ry2[i] >> col[i];
}
else
{
a[i] = 0;
ll tx1 , tx2 , ty1 , ty2;
cin >> tx1 >> ty1 >> tx2 >> ty2;
for(ll ty = ty2 ; ty >= ty1 ; ty--)
{
for(ll tx = tx1 ; tx <= tx2 ; tx++)
{
char now = '.';
for(int j = 1 ; j < i ; j++)
{
if(a[j] == 1)
{
if(check1(tx , ty , j))
{
now = col[j];
}
}
else if(a[j] == 2)
{
if(check2(tx , ty , j))
{
now = col[j];
}
}
}
cout << now;
}
cout << "\n";
}
}
}
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
3 1 1 2
output:
...............................................................................................................................................................................................................................................................................................................