QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#628837#7755. Game on a Forestcyc_43346WA 0ms3756kbC++202.4kb2024-10-10 22:39:592024-10-10 22:40:00

Judging History

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

  • [2024-10-10 22:40:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3756kb
  • [2024-10-10 22:39:59]
  • 提交

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()
{
  int nnn; cin>>nnn;
cout<<nnn-1;
return 0;
    cin.tie(0) -> sync_with_stdio(false);
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3584kb

input:

100000 1
4647 17816

output:

99999

result:

wrong answer 1st numbers differ - expected: '1', found: '99999'