QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555075#8558. Grid GamePhantomThresholdWA 0ms3844kbC++203.0kb2024-09-09 19:36:152024-09-09 19:36:15

Judging History

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

  • [2024-09-09 19:36:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-09-09 19:36:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int maxn = 21000;

int n;
vector<int>V[300];
int f[205][105];
inline void up(int &a,const int &b){ if(a<b)a=b; }

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int Tcase; cin>>Tcase;
    for(int ti=1;ti<=Tcase;ti++)
    {
        for(int i=1;i<=200;i++) V[i].clear();
        cin>>n;

        for(int i=1;i<=n;i++)
        {
            int x,y; cin>>x>>y;
            V[x+y].push_back(x-y);
        }
        for(int i=0;i<=101;i++) f[201][i]=ti;
        for(int i=200;i>=0;i--)
        {
            int ui=(i+1)/2;
            if(i%2==1)
            {
                for(int j=0;j<=ui;j++)
                {
                    //   -1    +1
                    int x=j, y=ui-x;

                    int ok=1;
                    for(auto c:V[i+1])
                    {
                        if(c==0) { ok=0;break; }
                        else if(c>0)
                        {
                            if(x*2>=c) { ok=0;break; }
                        }
                        else
                        {
                            if(y*2>=-c) { ok=0;break; }
                        }
                    }
                    if(ok) f[i][j]=f[i+1][j];
                    else f[i][j]=-1;
                }
            }
            else
            {
                for(int j=0;j<=ui;j++)
                {
                    //   -1    +1
                    int x=j, y=ui-x;

                    vector<int>v0,v1;
                    for(auto c:V[i+1])
                    {
                        if(c>=0)
                        {
                            if(c-x*2<=1) v1.push_back(c);
                            if(c-x*2<=-1) v0.push_back(c);
                        }
                        if(c<=0)
                        {
                            if(y*2+c>=1) v1.push_back(c);
                            if(y*2+c>=-1) v0.push_back(c);
                        }
                    }

                    if(i==6)
                        int kk=1;

                    int ok=1;
                    if( !v1.empty() && !v0.empty() )
                    {
                        if( (int)v1.size()>1 || (int)v0.size()>1 || ( v1[0]!=v0[0] ) )
                            ok=0;
                    }
                    if(ok)
                    {
                        if( v1.empty() && v0.empty() ) 
                        {
                            f[i][j]=max(f[i+1][j],f[i+1][j+1]);
                        }
                        else if( v1.empty() )
                            f[i][j]= f[i+1][j+1];
                        else if( v0.empty() ) 
                            f[i][j]= f[i+1][j];
                        else f[i][j]= min(f[i+1][j],f[i+1][j+1]);
                    }
                }
            }
        }

        if(f[0][0]==ti) cout<<"Yes\n";
        else cout<<"No\n";
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3844kb

input:

3
1
3 3
2
2 0
1 2
4
2 0
2 3
1 6
5 2

output:

No
Yes
No

result:

wrong answer expected YES, found NO [3rd token]