QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102400#5250. Combination Lockszswzswzsw#WA 2ms3404kbC++14810b2023-05-03 12:43:222023-05-03 12:43:31

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 12:43:31]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3404kb
  • [2023-05-03 12:43:22]
  • Submitted

answer

#include<iostream>
#include<cstring>
using namespace std;
const int N=2500;

int f[N];
int n,c;

int get_id(string &s){
    int ans=0;
    for(int i=0;i<s.size();++i)
        ans|=((s[i]=='=')<<i);
    return ans;
}

bool dfs(int k){
    if(f[k]!=-1)return f[k];
    bool res=0;
    for(int i=0;i<n;++i)
        if(!(k&(1<<i)))
            res|=!dfs(k|(1<<i));
    return f[k]=res;
}

int main(){
    int T;
    cin>>T;
    while(T--){
        memset(f,-1,sizeof(f));
        cin>>n>>c;
        string a,b,x;
        cin>>a>>b;
        for(int i=0;i<n;++i)
            x.push_back(a[i]==b[i]?'=':'.');
        int st=get_id(x);
        for(int i=1;i<=c;++i){
            cin>>x;
            f[get_id(x)]=1;
        }
        cout<<(dfs(st)?"Alice":"Bob")<<endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3404kb

input:

2
1 0
0
0
1 1
0
0
.

output:

Bob
Bob

result:

wrong answer 1st lines differ - expected: 'Alice', found: 'Bob'