QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#560975#8690. Archaeological RecoveryPhantomThreshold#WA 0ms3572kbC++202.1kb2024-09-12 19:16:042024-09-12 19:16:05

Judging History

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

  • [2024-09-12 19:16:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3572kb
  • [2024-09-12 19:16:04]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define int long long
#define lowbit(x) ((x)&(-x))
using namespace std;

const int maxn = 500;

int n,K,T,S;
int ci[300]; char cc[5];

int trans(int x,int c)
{
    vector<int>v(10);
    for(int i=0;i<K;i++)
    {
        v[i]= x%3;
        x/=3;
        v[i]=(v[i]+c%3)%3;
        c/=3;
    }
    for(int i=K-1;i>=0;i--) x=x*3+v[i];
    return x;
}
int num[300];
int ans[maxn],vis[maxn],go[maxn];
int check(int c)
{
    if(c==0)
    {
        for(int i=0;i<S;i++) if(num[i]%2==1)
            return 0;
        for(int i=0;i<S;i++) num[i]>>=1;
        return 1;
    }
    else
    {
        for(int i=0;i<S;i++) vis[i]=0,go[i]=0;
        for(int i=0;i<S;i++) if(vis[i]==0)
        {
            int x=i, y=trans(x,c), z=trans(y,c);
            if( (num[x]+num[y]+num[z])%2==1 ) return 0;
            go[x]= (num[x]-num[y]+num[z])/2;
            go[y]= (num[y]-num[z]+num[x])/2;
            go[z]= (num[z]-num[x]+num[y])/2;

            if(go[x]<0 or go[y]<0 or go[z]<0) return 0;

            if(i==0)
            {
                if( num[x]-go[x]+go[z]==0 ) return 0;
            }
        }
        for(int i=0;i<S;i++)
        {
            num[i]-=go[i];
            num[trans(i,c)]+=go[i];
        }
        return 1;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);

    ci['A']=0,ci['E']=1,ci['I']=2;
    cc[0]='0',cc[1]='+',cc[2]='-';

    cin>>n>>K>>T;
    S=1;
    for(int i=1;i<=K;i++) S*=3;
    for(int i=1;i<=T;i++)
    {
        string ss; cin>>ss;
        int now=0;
        for(int j=0;j<K;j++) 
        {
            int w= ci[(int)ss[j]];
            now=now*3+w;
        }
        cin>>num[now];
    }

    for(int i=1;i<=n;i++)
    {
        for(int c=0;c<S;c++) if(check(c))
        {
            ans[i]=c;
            break;
        }
    }

    for(int i=1;i<=n;i++)
    {
        int x=ans[i];
        string ai;
        for(int j=0;j<K;j++) ai.push_back(cc[x%3]),x/=3;
        reverse(ai.begin(),ai.end());
        cout<<ai<<endl;
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 3 14
IEA 1
AEI 1
AIE 1
EAE 2
IAA 1
AAI 1
AAA 2
AEE 1
IAE 1
EII 1
EEA 1
EAI 1
IIE 1
EIA 1

output:

0+-
0+-
0+-
0+-

result:

wrong answer wrong answer, for the configuration AAA expected 2, but you obtained 5