QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#619443#3016. Flashing Fluorescentsucup-team4153#WA 0ms3644kbC++20851b2024-10-07 14:13:322024-10-07 14:13:32

Judging History

This is the latest submission verdict.

  • [2024-10-07 14:13:32]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3644kb
  • [2024-10-07 14:13:32]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N=16;
const int M=(1<<16)+5;
string s;
bool dp[20][M];
signed main()
{
//    ios::sync_with_stdio(0);
//    cin.tie(0);cout.tie(0);
    cin>>s;
    int n=s.length();
    int st=0;
    for(auto ch:s){
        st<<=1;
        if(ch=='1')st+=1;
    }
    dp[0][(1<<n)-1]=true;
    if(dp[0][st]){
        cout<<0<<'\n';
        return 0;
    }
    for(int j=1;j<=n;j++){
        for(int i=0;i<(1<<n);i++){
            for(int k=0;k<n;k++){
                int res=min(j,k+1);
                int nxt=(i^(((1<<res)-1)<<(k-res+1)));
//                cout<<res<<' '<<k<<' '<<i<<' '<<nxt<<'\n';
                if(dp[j-1][nxt])dp[j][i]=true;
            }
        }
        if(dp[j][st]){
            cout<<j<<'\n';
            break;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1101

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

1

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

000

output:

2

result:

ok 1 number(s): "2"

Test #4:

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

input:

0

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

1

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

00

output:

2

result:

ok 1 number(s): "2"

Test #7:

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

input:

01

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

10

output:

1

result:

ok 1 number(s): "1"

Test #9:

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

input:

11

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

000

output:

2

result:

ok 1 number(s): "2"

Test #11:

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

input:

001

output:

3

result:

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