QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#862555#9980. Boolean Function Reconstructionucup-team1134#AC ✓766ms4352kbC++2310.3kb2025-01-19 03:12:102025-01-19 03:12:11

Judging History

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

  • [2025-01-19 03:12:11]
  • 评测
  • 测评结果:AC
  • 用时:766ms
  • 内存:4352kb
  • [2025-01-19 03:12:10]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;

string AND(vi pos){
    if(si(pos)==0) return "T";
    else if(si(pos)==1) return string(1,char('a'+pos[0]));
    else{
        vi A,B;
        for(int i=0;i<si(pos);i++){
            if(i<si(pos)/2) A.pb(pos[i]);
            else B.pb(pos[i]);
        }
        auto aa=AND(A),bb=AND(B);
        string res;
        res+='(';
        res+=aa;
        res+='&';
        res+=bb;
        res+=')';
        return res;
    }
}

string OR(vst pos){
    if(si(pos)==0) return "F";
    else if(si(pos)==1) return pos[0];
    else{
        vst A,B;
        for(int i=0;i<si(pos);i++){
            if(i<si(pos)/2) A.pb(pos[i]);
            else B.pb(pos[i]);
        }
        auto aa=OR(A),bb=OR(B);
        string res;
        res+='(';
        res+=aa;
        res+='|';
        res+=bb;
        res+=')';
        return res;
    }
}

string solve(int N,string S){
    vst ans;
    string U(1<<N,'0');
    vi iru(1<<N);
    for(int bit=0;bit<(1<<N);bit++){
        bool ok=true;
        int rem=(1<<N)-1-bit;
        for(int T=rem;;T=(T-1)&rem){
            ok&=(S[bit|T]=='1');
            if(T==0) break;
        }
        if(ok){
            iru[bit]=true;
            for(int T=rem;;T=(T-1)&rem){
                U[bit|T]='1';
                if(T==0) break;
            }
        }
    }
    
    if(U==S){
        
        for(int bit=(1<<N)-1;bit>=0;bit--){
            if(iru[bit]){
                bool kesu=true;
                for(int i=0;i<N;i++){
                    if(bit&(1<<i)){
                        kesu&=(iru[bit^(1<<i)]);
                    }
                }
                //if(kesu) iru[bit]=false;
            }
        }
        for(int bit=0;bit<(1<<N);bit++){
            if(iru[bit]){
                vi fff;
                for(int i=0;i<N;i++){
                    if(bit&(1<<i)) fff.pb(i);
                }
                ans.pb(AND(fff));
            }
        }
        for(int i=0;i<N;i++){
            for(int bit=0;bit<(1<<N);bit++){
                if(!(bit&(1<<i))){
                    chmax(U[bit|(1<<i)],U[bit]);
                }
            }
        }
        assert(U==S);
        return OR(ans);
    }else{
        U=S;
        for(int i=0;i<N;i++){
            for(int bit=0;bit<(1<<N);bit++){
                if(!(bit&(1<<i))){
                    chmax(U[bit|(1<<i)],U[bit]);
                }
            }
        }
        assert(U!=S);
        return "NG";
    }
}
string X;
map<string,string> MA;
string DFS(string S,int u){
    if(u==3&&si(X)){
        //assert(MA.count(S));
        return MA[S];
    }
    if(u==2){
        if(S=="00010011") return "(b&(a|c))";
        if(S=="00010101") return "(a&(b|c))";
        if(S=="00110111") return "(b|(a&c))";
        if(S=="01010111") return "(a|(b&c))";
    }
    if(u==1){
        if(S=="0000") return "F";
        if(S=="0001") return "(b&a)";
        if(S=="0011") return "b";
        if(S=="0101") return "a";
        if(S=="0111") return "(b|a)";
        if(S=="1111") return "T";
        return "";
    }
    if(u==0){
        if(S=="00") return "F";
        else if(S=="11") return "T";
        else if(S=="01") return "a";
        else{
            //cout<<X<<endl;
            exit(1);
            return "oh";
        }
    }else{
        string A,B;
        for(int bit=0;bit<si(S)/2;bit++){
            if(S[bit]=='0'){
                if(S[bit+si(S)/2]=='0'){
                    A+='0';
                    B+='0';
                }else{
                    A+='1';
                    B+='0';
                }
            }else{
                if(S[bit+si(S)/2]=='0'){
                    //cout<<X<<endl;
                    exit(1);
                }else{
                    A+='1';
                    B+='1';
                }
            }
        }
        
        if(A==B){
            auto aa=DFS(A,u-1);
            return aa;
        }
        
        auto aa=DFS(A,u-1),bb=DFS(B,u-1);
        if(aa=="F"){
            return bb;
        }
        if(aa=="T"){
            if(bb=="T"){
                return "T";
            }
            if(bb=="F"){
                return string(1,char('a'+u));
            }
            string Z;
            Z+='(';
            Z+=char('a'+u);
            Z+='|';
            Z+=bb;
            Z+=')';
            return Z;
        }
        if(bb=="F"){
            string Z;
            Z+='(';
            Z+=char('a'+u);
            Z+='&';
            Z+=aa;
            Z+=')';
            return Z;
        }
        if(bb=="T"){
            return "T";
        }
        string Z;
        Z+='(';
        Z+='(';
        Z+=char('a'+u);
        Z+='&';
        Z+=aa;
        Z+=')';
        Z+='|';
        Z+=bb;
        Z+=')';
        return Z;
    }
}

string solve2(int N,string S){
    string U=S;
    for(int i=0;i<N;i++){
        for(int bit=0;bit<(1<<N);bit++){
            if(!(bit&(1<<i))){
                chmax(U[bit|(1<<i)],U[bit]);
            }
        }
    }
    if(U!=S) return "NG";
    return DFS(S,N-1);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string solve3(int N,string S){
    pair<int,string> re=mp(INF,"");
    for(int q=0;q<20;q++){
        vi id(N);iota(all(id),0);
        shuffle(all(id),rng);
        string nex(1<<N,'0');
        for(int i=0;i<(1<<N);i++){
            if(S[i]=='1'){
                int to=0;
                for(int j=0;j<N;j++){
                    if(i&(1<<j)) to|=(1<<id[j]);
                }
                nex[to]='1';
            }
        }
        auto aa=solve2(N,nex);
        int cn=0;
        for(int i=0;i<si(aa);i++){
            if(aa[i]=='|'||aa[i]=='&') cn++;
        }
        string bb;
        vi inv(N);
        for(int i=0;i<N;i++){
            inv[id[i]]=i;
        }
        for(int i=0;i<si(aa);i++){
            if('a'<=aa[i]&&aa[i]<='z'){
                bb+=char('a'+(inv[aa[i]-'a']));
            }else{
                bb+=aa[i];
            }
        }
        chmin(re,mp(cn,bb));
    }
    return re.se;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    for(int N=4;N<=4;N++){
        for(ll bit=0;bit<(1LL<<(1LL<<N));bit++){
            string S;
            for(int i=0;i<(1LL<<N);i++){
                if(bit&(1LL<<((1LL<<N)-1-i))) S+='1';
                else S+='0';
            }
            auto a=solve2(N,S);
            if(a=="NG") continue;
            auto aa=solve3(N,S);
            int cn=0;
            for(int i=0;i<si(aa);i++){
                if(a[i]=='|'||a[i]=='&') cn++;
            }
            
            //cout<<"if(S=="<<'"'<<S<<'"'<<") return "<<'"'<<aa<<'"'<<";\n";
            MA[S]=aa;
            //cout<<S<<" "<<aa<<endl;
            //cout<<N<<" "<<cn<<" "<<S<<endl;
        }
    }
    X="DONE";
    /*
     mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
     
     int ma=0;
     while(1){
     int N=8;
     string S(1<<N,'0');
     for(int bi=0;bi<(1<<N);bi++){
     int z=rand()%10;
     if(z==0){
     for(int y=0;y<(1<<N);y++){
     if((y&bi)==bi) S[y]='1';
     }
     }
     }
     auto a=solve2(N,S);
     if(a=="NG") continue;
     pair<int,string> re=mp(INF,"");
     for(int q=0;q<20;q++){
     vi id(N);iota(all(id),0);
     shuffle(all(id),rng);
     string nex(1<<N,'0');
     for(int i=0;i<(1<<N);i++){
     if(S[i]=='1'){
     int to=0;
     for(int j=0;j<N;j++){
     if(i&(1<<j)) to|=(1<<id[j]);
     }
     nex[to]='1';
     }
     }
     auto aa=solve2(N,nex);
     int cn=0;
     for(int i=0;i<si(aa);i++){
     if(aa[i]=='|'||aa[i]=='&') cn++;
     }
     chmin(re,mp(cn,nex));
     }
     int cn=0;
     for(int i=0;i<si(a);i++){
     if(a[i]=='|'||a[i]=='&') cn++;
     }
     cn=re.fi;
     if(chmax(ma,cn)) cout<<ma<<" "<<(1<<(N-1))+10<<" "<<a<<" "<<S<<endl;
     //cout<<N<<" "<<ma<<" "<<(1<<(N-1))+10<<endl;
     }
     */
    int Q;cin>>Q;
    while(Q--){
        int N;cin>>N;
        string S;cin>>S;
        auto ans=solve2(N,S);
        if(ans=="NG") cout<<"No\n";
        else{
            cout<<"Yes\n";
            while(1){
                vi id(N);iota(all(id),0);
                shuffle(all(id),rng);
                string nex(1<<N,'0');
                for(int i=0;i<(1<<N);i++){
                    if(S[i]=='1'){
                        int to=0;
                        for(int j=0;j<N;j++){
                            if(i&(1<<j)) to|=(1<<id[j]);
                        }
                        nex[to]='1';
                    }
                }
                auto aa=solve2(N,nex);
                int cn=0;
                for(int i=0;i<si(aa);i++){
                    if(aa[i]=='|'||aa[i]=='&') cn++;
                }
                if(cn<=((1<<(N-1))+10)){
                    vi inv(N);
                    for(int i=0;i<N;i++){
                        inv[id[i]]=i;
                    }
                    for(int i=0;i<si(aa);i++){
                        if('a'<=aa[i]&&aa[i]<='z'){
                            cout<<char('a'+(inv[aa[i]-'a']));
                        }else{
                            cout<<aa[i];
                        }
                    }
                    cout<<"\n";
                    break;
                }
            }
        }
    }
}



这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 15ms
memory: 3712kb

input:

7
2
0001
2
0111
2
1111
3
00010111
1
10
2
0101
5
00000000000000000000000000000001

output:

Yes
(a&b)
Yes
(b|a)
Yes
T
Yes
((b&(a|c))|(a&c))
No
Yes
a
Yes
(e&(d&(c&(b&a))))

result:

ok 7 lines, tightest: 4 out of 14 (7 test cases)

Test #2:

score: 0
Accepted
time: 14ms
memory: 3840kb

input:

4
1
00
1
10
1
01
1
11

output:

Yes
F
No
Yes
a
Yes
T

result:

ok 4 lines, tightest: 0 out of 11 (4 test cases)

Test #3:

score: 0
Accepted
time: 14ms
memory: 3584kb

input:

16
2
0000
2
1000
2
0100
2
1100
2
0010
2
1010
2
0110
2
1110
2
0001
2
1001
2
0101
2
1101
2
0011
2
1011
2
0111
2
1111

output:

Yes
F
No
No
No
No
No
No
No
Yes
(a&b)
No
Yes
a
No
Yes
b
No
Yes
(b|a)
Yes
T

result:

ok 16 lines, tightest: 1 out of 12 (16 test cases)

Test #4:

score: 0
Accepted
time: 14ms
memory: 3712kb

input:

256
3
00000000
3
10000000
3
01000000
3
11000000
3
00100000
3
10100000
3
01100000
3
11100000
3
00010000
3
10010000
3
01010000
3
11010000
3
00110000
3
10110000
3
01110000
3
11110000
3
00001000
3
10001000
3
01001000
3
11001000
3
00101000
3
10101000
3
01101000
3
11101000
3
00011000
3
10011000
3
01011000...

output:

Yes
F
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 256 lines, tightest: 4 out of 14 (256 test cases)

Test #5:

score: 0
Accepted
time: 31ms
memory: 3840kb

input:

65536
4
0000000000000000
4
1000000000000000
4
0100000000000000
4
1100000000000000
4
0010000000000000
4
1010000000000000
4
0110000000000000
4
1110000000000000
4
0001000000000000
4
1001000000000000
4
0101000000000000
4
1101000000000000
4
0011000000000000
4
1011000000000000
4
0111000000000000
4
1111000...

output:

Yes
F
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 65536 lines, tightest: 8 out of 18 (65536 test cases)

Test #6:

score: 0
Accepted
time: 15ms
memory: 3840kb

input:

168
4
0000000000000000
4
0000000000000001
4
0000000000000011
4
0000000000000101
4
0000000000000111
4
0000000000001111
4
0000000000010001
4
0000000000010011
4
0000000000010101
4
0000000000010111
4
0000000000011111
4
0000000000110011
4
0000000000110111
4
0000000000111111
4
0000000001010101
4
000000000...

output:

Yes
F
Yes
(a&(c&(d&b)))
Yes
(d&(b&c))
Yes
(d&(c&a))
Yes
(c&(d&(b|a)))
Yes
(c&d)
Yes
(b&(a&d))
Yes
(d&(b&(c|a)))
Yes
(a&(d&(c|b)))
Yes
(d&((b&(a|c))|(a&c)))
Yes
(d&(c|(a&b)))
Yes
(d&b)
Yes
(d&(b|(a&c)))
Yes
(d&(c|b))
Yes
(a&d)
Yes
(d&(a|(b&c)))
Yes
(d&(c|a))
Yes
(d&(b|a))
Yes
(d&(b|(a|c)))
Yes
d
Yes
...

result:

ok 168 lines, tightest: 8 out of 18 (168 test cases)

Test #7:

score: 0
Accepted
time: 30ms
memory: 3840kb

input:

7581
5
00000000000000000000000000000000
5
00000000000000000000000000000001
5
00000000000000000000000000000011
5
00000000000000000000000000000101
5
00000000000000000000000000000111
5
00000000000000000000000000001111
5
00000000000000000000000000010001
5
00000000000000000000000000010011
5
0000000000000...

output:

Yes
F
Yes
(a&(c&(d&(b&e))))
Yes
(e&(c&(d&b)))
Yes
(d&(a&(c&e)))
Yes
((a&(c&(e&d)))|(c&(e&(d&b))))
Yes
(c&(e&d))
Yes
(e&(d&(a&b)))
Yes
(d&(b&(e&(a|c))))
Yes
(e&(d&(a&(c|b))))
Yes
((a&(d&(e&(b|c))))|(d&(b&(e&c))))
Yes
(d&(e&(c|(b&a))))
Yes
(b&(e&d))
Yes
((b&(e&d))|(e&(c&(a&d))))
Yes
((b&(e&d))|(e&(c&d...

result:

ok 7581 lines, tightest: 18 out of 26 (7581 test cases)

Test #8:

score: 0
Accepted
time: 19ms
memory: 4096kb

input:

14
1
01
2
0111
3
00010111
4
0001011101111111
5
00000001000101110001011101111111
6
0000000100010111000101110111111100010111011111110111111111111111
7
00000000000000010000000100010111000000010001011100010111011111110000000100010111000101110111111100010111011111110111111111111111
8
00000000000000010000...

output:

Yes
a
Yes
(a|b)
Yes
((c&(b|a))|(b&a))
Yes
((c&(d|(b|a)))|((d&(b|a))|(b&a)))
Yes
((e&((a&(d|(b|c)))|((d&(b|c))|(b&c))))|((a&((d&(c|b))|(c&b)))|(d&(c&b))))
Yes
((f&((e&(b|(d|(c|a))))|((b&(c|(a|d)))|((c&(a|d))|(a&d)))))|((e&((b&(c|(a|d)))|((c&(a|d))|(a&d))))|((b&((c&(d|a))|(d&a)))|(c&(d&a)))))
Yes
((b&...

result:

ok 14 lines, tightest: 68 out of 74 (14 test cases)

Test #9:

score: 0
Accepted
time: 18ms
memory: 4096kb

input:

14
1
01
2
0001
3
00010111
4
0000000100010111
5
00000001000101110001011101111111
6
0000000000000001000000010001011100000001000101110001011101111111
7
00000000000000010000000100010111000000010001011100010111011111110000000100010111000101110111111100010111011111110111111111111111
8
00000000000000000000...

output:

Yes
a
Yes
(a&b)
Yes
((a&(b|c))|(b&c))
Yes
((a&((c&(d|b))|(d&b)))|(c&(d&b)))
Yes
((d&((b&(c|(e|a)))|((c&(e|a))|(e&a))))|((b&((c&(e|a))|(e&a)))|(c&(e&a))))
Yes
((e&((a&((f&(b|(d|c)))|((b&(d|c))|(d&c))))|((f&((b&(d|c))|(d&c)))|(b&(d&c)))))|((a&((f&((b&(d|c))|(d&c)))|(b&(d&c))))|(f&(b&(c&d)))))
Yes
((g&...

result:

ok 14 lines, tightest: 68 out of 74 (14 test cases)

Test #10:

score: 0
Accepted
time: 20ms
memory: 3968kb

input:

14
1
00
2
0001
3
00000001
4
0000000100010111
5
00000000000000010000000100010111
6
0000000000000001000000010001011100000001000101110001011101111111
7
00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111
8
00000000000000000000...

output:

Yes
F
Yes
(a&b)
Yes
(c&(b&a))
Yes
((b&((a&(d|c))|(d&c)))|(a&(d&c)))
Yes
((a&((c&((b&(d|e))|(d&e)))|(b&(d&e))))|(c&(d&(e&b))))
Yes
((f&((a&((e&(c|(b|d)))|((c&(b|d))|(b&d))))|((e&((b&(c|d))|(c&d)))|(b&(c&d)))))|((a&((e&((b&(c|d))|(c&d)))|(b&(c&d))))|(e&(c&(d&b)))))
Yes
((f&((d&((c&((e&(a|(b|g)))|((a&(...

result:

ok 14 lines, tightest: 33 out of 42 (14 test cases)

Test #11:

score: 0
Accepted
time: 17ms
memory: 4096kb

input:

14
1
00
2
0000
3
00000001
4
0000000000000001
5
00000000000000010000000100010111
6
0000000000000000000000000000000100000000000000010000000100010111
7
00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111
8
00000000000000000000...

output:

Yes
F
Yes
F
Yes
(a&(c&b))
Yes
(c&(d&(a&b)))
Yes
((b&((d&((a&(c|e))|(c&e)))|(a&(c&e))))|(d&(a&(e&c))))
Yes
((f&((d&((c&((a&(b|e))|(b&e)))|(a&(b&e))))|(c&(a&(e&b)))))|(d&(c&(a&(e&b)))))
Yes
((c&((a&((e&((b&(f|(d|g)))|((f&(d|g))|(d&g))))|((b&((f&(g|d))|(g&d)))|(f&(g&d)))))|((e&((b&((f&(g|d))|(g&d)))|(f...

result:

ok 14 lines, tightest: 0 out of 11 (14 test cases)

Test #12:

score: 0
Accepted
time: 21ms
memory: 4352kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
((i&((f&((j&((d&((c&((e&((l&(o|(k|(a|(h|(b|(m|(g|n))))))))|((o&(k|(a|(h|(b|(m|(g|n)))))))|((k&(a|(h|(b|(m|(g|n))))))|((a&(h|(b|(m|(g|n)))))|((h&(b|(m|(g|n))))|((b&(m|(n|g)))|((m&(n|g))|(n&g)))))))))|((l&((o&(k|(a|(h|(b|(m|(g|n)))))))|((k&(a|(h|(b|(m|(g|n))))))|((a&(h|(b|(m|(g|n)))))|((h&(b|(m|(g...

result:

ok 1 lines, tightest: 12868 out of 16394 (1 test case)

Test #13:

score: 0
Accepted
time: 18ms
memory: 4352kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

Yes
((o&((f&((a&((m&((c&((g&(h|(n|(i|(j|(d|(b|(l|(e|k)))))))))|((h&(n|(i|(j|(d|(b|(l|(e|k))))))))|((n&(i|(j|(d|(b|(l|(e|k)))))))|((i&(j|(d|(b|(l|(e|k))))))|((j&(d|(b|(l|(e|k)))))|((d&(b|(l|(e|k))))|((b&(l|(e|k)))|((l&(e|k))|(e&k))))))))))|((g&((h&(n|(i|(j|(d|(b|(l|(e|k))))))))|((n&(i|(j|(d|(b|(l|(e|...

result:

ok 1 lines, tightest: 11438 out of 16394 (1 test case)

Test #14:

score: 0
Accepted
time: 19ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((i&((m&((e&((c&((l&((f&((o&((k&(g|(h|(n|(b|(a|(j|d)))))))|((g&(h|(n|(b|(a|(j|d))))))|((h&(n|(b|(a|(j|d)))))|((n&(b|(a|(j|d))))|((b&(d|(a|j)))|((d&(a|j))|(a&j))))))))|((k&((g&(h|(n|(b|(a|(j|d))))))|((h&(n|(b|(a|(j|d)))))|((n&(b|(a|(j|d))))|((b&(d|(a|j)))|((d&(a|j))|(a&j)))))))|((g&((h&(n|(b|(a|(...

result:

ok 1 lines, tightest: 11438 out of 16394 (1 test case)

Test #15:

score: 0
Accepted
time: 19ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((g&((a&((h&((n&((l&((b&((e&((d&((k&(f|(o|(c|(i|(j|m))))))|((f&(o|(c|(i|(j|m)))))|((o&(c|(i|(j|m))))|((c&(i|(j|m)))|((i&(j|m))|(j&m)))))))|((k&((f&(o|(c|(i|(j|m)))))|((o&(c|(i|(j|m))))|((c&(i|(j|m)))|((i&(j|m))|(j&m))))))|((f&((o&(c|(i|(j|m))))|((c&(i|(j|m)))|((i&(j|m))|(j&m)))))|((o&((c&(i|(j|m...

result:

ok 1 lines, tightest: 8006 out of 16394 (1 test case)

Test #16:

score: 0
Accepted
time: 323ms
memory: 3840kb

input:

65536
6
0000001101111111000111111111111101111111111111111111111111111111
6
0000000000000000000100110011011100000000000000000001001100111111
6
0101010101110111011101111111111101110111111111111111111111111111
6
0000001100000011000000110001011100011111001111110011111100111111
6
000000010001011100000001...

output:

Yes
((b&(f|(c|(d|(e&a)))))|((f&(e|(a|(c|d))))|((e&(c|d))|(d&(a|c)))))
Yes
((c&(e&(b|(d&(f|a)))))|(e&(b&(a|d))))
Yes
((d&(f|(b|(e|a))))|((f&(b|(e|a)))|(a|(b&e))))
Yes
((f&((a&(b|c))|(c|(b&(e|d)))))|((a&((b&(c|(e&d)))|(d&(e&c))))|(b&c)))
Yes
((b&((a&(f|(c|d)))|((f&(c|d))|(c&d))))|(a&(c&(f|d))))
Yes
((...

result:

ok 65536 lines, tightest: 36 out of 42 (65536 test cases)

Test #17:

score: 0
Accepted
time: 725ms
memory: 3584kb

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

Yes
(f&(c&(g&(a&(b&(e&d))))))
Yes
((a&((g&(d|(b|e)))|((c&(b|((f&(d|e))|(d&e))))|((f&(d|(b|e)))|((d&(b|e))|(b&e))))))|((g&((c&((d&(b|e))|(b&e)))|((d&(b|(f&e)))|(e&b))))|((c&((f&((d&(e|b))|(e&b)))|(d&(e&b))))|(b&((d&(e|f))|(e&f))))))
Yes
((a&((c&(b|((f&(d|e))|(d&e))))|((f&(b|d))|(b&d))))|((g&((c&((f&(...

result:

ok 65536 lines, tightest: 73 out of 74 (65536 test cases)

Test #18:

score: 0
Accepted
time: 410ms
memory: 3840kb

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

Yes
((h&((d&((g&((c&((e&(a|(b|f)))|((a&(b|f))|(b&f))))|((e&(b|(a&f)))|(f&(a&b)))))|((e&((a&(b|f))|(b&f)))|(a&(b&f)))))|((g&((c&((e&((a&(b|f))|(b&f)))|(a&(b&f))))|(b&((e&(a|f))|(a&f)))))|(e&(a&(b&f))))))|((d&((g&((c&((e&((a&(b|f))|(b&f)))|(a&(b&f))))|(b&((e&(a|f))|(a&f)))))|(e&(a&(b&f)))))|(g&(e&(a&(...

result:

ok 16384 lines, tightest: 138 out of 138 (16384 test cases)

Test #19:

score: 0
Accepted
time: 231ms
memory: 3584kb

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

Yes
((e&((i&((h&((c&(d|(f|((g&(b|a))|(b&a)))))|((d&(f|((g&(b|a))|(b&a))))|((g&(f|(b&a)))|(f&(b|a))))))|((c&((d&(g|(b|(a|f))))|(f|((g&(b|a))|(b&a)))))|((d&(f|((g&(b|a))|(b&a))))|((b&(f|(g&a)))|(a&f))))))|((h&((c&((d&(f&((g&(a|b))|(a&b))))|(g&(b&(a&f)))))|(d&(g&(b&(a&f))))))|(c&(d&(f&((g&(a|b))|(a&b))...

result:

ok 4096 lines, tightest: 258 out of 266 (4096 test cases)

Test #20:

score: 0
Accepted
time: 128ms
memory: 3712kb

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

Yes
((d&((c&((j&(e|(a|(g|(h|(i|(b|f)))))))|((e&((a&((g&(b|((i&(f|h))|(f&h))))|(b|(f&(h|i)))))|((g&(b|(f&(h|i))))|((i&(b|f))|(b&(h|f))))))|((a&((g&(b|(f&(h|i))))|((i&(b|f))|(b&(h|f)))))|((g&((i&(b|f))|(b&(h|f))))|((h&(b|(i&f)))|(b&(i|f))))))))|((j&((e&((a&((g&(b|(f&(h|i))))|(b|(i&f))))|((g&(b|(f&(h|i...

result:

ok 1024 lines, tightest: 511 out of 522 (1024 test cases)

Test #21:

score: 0
Accepted
time: 75ms
memory: 3840kb

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((b&((f&((c&((i&((d&(h|j))|((k&(h|j))|((h&(e|(j|(g|a))))|j))))|((d&((k&((h&j)|(e&(j&a))))|(h&j)))|(h&j))))|((i&((d&((k&((h&(e|(j|a)))|j))|((h&(j|(e&(g|a))))|(j&(e|(g&a))))))|((k&((h&(j|(e&(g&a))))|(e&(j&(g|a)))))|(h&j))))|((d&((k&(h&j))|(h&(j&(e|a)))))|((k&(h&(e&j)))|(h&(e&(g&(a&j)))))))))|((c&(...

result:

ok 256 lines, tightest: 863 out of 1034 (256 test cases)

Test #22:

score: 0
Accepted
time: 45ms
memory: 3968kb

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

Yes
((b&(i|(d|(a|((l&(c|(e|k)))|((g&(c|(e|k)))|((f&(c|(e|k)))|((c&(e|(k|j)))|(e|k)))))))))|((i&(d|(a|(l|((g&((f&(c|(e|(k|j))))|(c|(e|k))))|((f&(c|(e|(k|(h&j)))))|(c|(e|k))))))))|(d|((a&((l&((g&(f|(c|(e|(k|(j|h))))))|(f|(c|(e|(k|j))))))|(c|(e|k))))|((l&((g&((f&((c&(e|(k|(j|h))))|(e|k)))|((c&(e|(k|j))...

result:

ok 64 lines, tightest: 1438 out of 2058 (64 test cases)

Test #23:

score: 0
Accepted
time: 31ms
memory: 3968kb

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

Yes
((j&((c&((f&((b&(h|((m&((l&((k&(d|(i|(g|e))))|(i|(g|e))))|((k&(i|(g|e)))|(i|(g|(d&e))))))|((l&((k&(i|(g|e)))|((a&(i|(g|e)))|(i|(g|(d&e))))))|((k&(i|(g|(d&e))))|((a&(g|((d&(e|i))|(e&i))))|(g|(i&(d|e)))))))))|(h|((m&((l&((k&(i|(g|e)))|((a&(i|(g|(d&e))))|(g|((d&(e|i))|(e&i))))))|((k&(g|((d&(e|i))|(...

result:

ok 16 lines, tightest: 3233 out of 4106 (16 test cases)

Test #24:

score: 0
Accepted
time: 23ms
memory: 4096kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((e&((d&((a&((i&((j&((m&((g&((h&((n&((c&(f|(l|(b|k))))|(f|(l|(k&b)))))|((c&(f|(l|k)))|(f|((l&(k|b))|(k&b))))))|((n&((c&(f|(l|(k&b))))|(f|((l&(k|b))|(k&b)))))|((c&(f|(l|(k&b))))|((f&(l|(b|k)))|(l&(b|k)))))))|((h&((n&((c&(f|(l|(b|k))))|(f|(l|(k&b)))))|((c&(f|(l|k)))|(f|((l&(k|b))|(k&b))))))|((n&((...

result:

ok 4 lines, tightest: 3987 out of 8202 (4 test cases)

Test #25:

score: 0
Accepted
time: 25ms
memory: 4096kb

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

Yes
((e&((l&((j&((i&(g|((b&((d&(k|(f|(a|(n|c)))))|((k&(f|(a|(n|c))))|(f|(a|n)))))|((d&((k&(f|(a|(n|c))))|(f|(a|n))))|((k&(f|(a|n)))|((f&(a|(n|c)))|(a|(n&c))))))))|((g&((b&(d|(k|(f|(a|(h|(n|c)))))))|((d&(k|(f|(a|(n|c)))))|((k&(f|(a|(n|c))))|(f|(a|n))))))|((b&((d&((k&(f|(a|n)))|((f&(a|(n|c)))|(a|(n&c)...

result:

ok 4 lines, tightest: 3930 out of 8202 (4 test cases)

Test #26:

score: 0
Accepted
time: 23ms
memory: 3968kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((a&((h&((n&((c&((j&((l&((i&((b&(e|(m|(f|(d|g)))))|(e|((g&(m|(d|f)))|(d&(f|m))))))|((b&((e&((k&(f|(g|d)))|(g|(d|(m&f)))))|(g&(d&(m|f)))))|(e&((k&((f&(g|d))|(d&(m|g))))|((f&(d|(m&g)))|(g&d)))))))|(i&((b&((e&((g&(m|(d|f)))|(d&(f|m))))|(m&(f&(g&d)))))|(e&(g&(d&(m|f))))))))|((l&((i&((b&(e|(g|(d|(m&f...

result:

ok 4 lines, tightest: 6008 out of 8202 (4 test cases)

Test #27:

score: 0
Accepted
time: 23ms
memory: 4096kb

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

Yes
((c&((m&((f&((d&((h&(j|(e|(l|(n|(g|(k|(a|(b|i)))))))))|((j&((e&(l|(n|(g|(b|(i|(k&a)))))))|(l|(n|((g&(k|(a|(b|i))))|(b|i))))))|((e&(l|(n|(g|(b|i)))))|(l|(n|((g&(k|(b|i)))|(b|i))))))))|((h&((j&((e&(l|(n|((g&(k|(b|i)))|(b|i)))))|((l&(n|(g|(k|(b|i)))))|(n|((g&(b|(i|(k&a))))|(b|i))))))|((e&((l&(n|(g|...

result:

ok 4 lines, tightest: 5819 out of 8202 (4 test cases)

Test #28:

score: 0
Accepted
time: 25ms
memory: 4096kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

Yes
((d&((h&((f&((i&((b&((c&(g|(k|(m|(l|(a|j))))))|((e&((g&((k&(m|(l|(a|j))))|((m&(l|(a|j)))|(j|(l&a)))))|((k&((m&(l|(a|j)))|(a|j)))|((m&(j|(l&a)))|((l&(j|(n&a)))|(a&j))))))|((g&((k&(m|(l|(a|j))))|((m&(l|(a|j)))|(j|(l&a)))))|((k&((m&(l|(a|j)))|(j|(a&(n|l)))))|((m&(j|(l&a)))|((l&(j|(n&a)))|(a&j))))))...

result:

ok 4 lines, tightest: 3687 out of 8202 (4 test cases)

Test #29:

score: 0
Accepted
time: 18ms
memory: 4096kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((d&((a&((k&((j&((c&((g&((e&((m&((o&((f&((l&(h|((n&(i|b))|(i&b))))|((n&(i|(h|b)))|(h&(b|i)))))|((l&((n&(h|(i&b)))|(h&(i&b))))|(n&(h&(i|b))))))|((f&((l&((n&(h|(i&b)))|(h&(i&b))))|(n&(h&(i|b)))))|(l&(n&(i&(b&h)))))))|((o&((f&((l&((n&(i|(h|b)))|((i&(h|b))|(h&b))))|((n&(h|(i&b)))|(h&(i&b)))))|((l&(h...

result:

ok 1 lines, tightest: 1618 out of 16394 (1 test case)

Test #30:

score: 0
Accepted
time: 19ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((c&((b&((f&((g&((o&((l&((i&(j|(e|((k&((n&(d|(h|m)))|(d|h)))|((n&(d|(h|m)))|(h|(d&m)))))))|((j&(e|(d|(h|m))))|((e&(d|(h|m)))|((k&((n&(h|(d&m)))|((d&(h|(a&m)))|(m&h))))|((n&((d&(h|m))|(h&m)))|(h&(d|m))))))))|((i&((j&(e|(n|(d|(h|m)))))|((e&(n|(d|(h|m))))|((k&((n&(h|(d&(a|m))))|((d&(h|m))|(h&m))))|...

result:

ok 1 lines, tightest: 4622 out of 16394 (1 test case)

Test #31:

score: 0
Accepted
time: 20ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
((d&((c&((b&((a&((g&((m&((k&((f&(n|(o|(h|(e|(i|(j&l)))))))|((n&(o|(h|(e|(j|i)))))|((o&(h|(e|(j|i))))|((h&(e|(j|i)))|((e&(j|i))|(j&i)))))))|((f&((n&(o|(h|(e|(j|(i|l))))))|((o&(h|(e|(j|(i|l)))))|((h&(e|(j|(i|l))))|((e&(j|(i|l)))|(j&i))))))|((n&(o|(h|(e|(i|(j&l))))))|((o&(h|(e|(i|(j&l)))))|((h&(e|(...

result:

ok 1 lines, tightest: 8125 out of 16394 (1 test case)

Test #32:

score: 0
Accepted
time: 20ms
memory: 4352kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

Yes
((a&((k&((n&((m&((i&((j&(h|((g&(f|(b|(l|(c|(d|e))))))|((f&(b|(l|(c|(d|e)))))|((b&(l|(c|(d|e))))|((l&(c|(d|e)))|(c|e)))))))|((h&(g|(f|(b|(l|(c|(d|e)))))))|((g&((f&(b|(l|(c|(d|(e|o))))))|(b|(c|(d|e)))))|((f&(b|(c|(d|e))))|((b&(c|(d|e)))|((l&(c|(e|(o&d))))|((c&(d|e))|(d&e)))))))))|((j&((h&((g&(f|(b...

result:

ok 1 lines, tightest: 6661 out of 16394 (1 test case)

Test #33:

score: 0
Accepted
time: 19ms
memory: 4096kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((e&((n&((m&((o&((a&((c&((k&((g&((h&(d|((l&(f|(b|i)))|((f&(b|(i|j)))|(b&(i|j))))))|((d&((l&(f|(b|i)))|((b&(f|(j|i)))|(f|(j&i)))))|((l&(f&(b&(i|j))))|(f&(b&i))))))|((h&(d|((l&(f|(b|(i&j))))|((f&(b|i))|(b&i)))))|((d&((l&(f|(b|i)))|((f&(b|(i|j)))|(b&i))))|(f&(b&i))))))|((g&((h&((d&((l&(f|(b|(j|i)))...

result:

ok 1 lines, tightest: 3141 out of 16394 (1 test case)

Test #34:

score: 0
Accepted
time: 20ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

Yes
((o&((k&((e&((c&((n&((f&(a|(h|(d|(i|(j|(g|m)))))))|((a&(h|(d|(i|(j|(l|(m|(g|b))))))))|(h|((d&(i|(j|(l|(m|(g|b))))))|((i&(j|(l|(m|(g|b)))))|((j&(g|(m|(l&b))))|((l&(m|(g&b)))|(m&(g|b))))))))))|((f&((a&(h|((d&(i|(j|(l|(m|(g|b))))))|((i&(j|(l|(m|(g|b)))))|((j&(l|(g|m)))|(m|(g&(l|b))))))))|((h&(d|(i|...

result:

ok 1 lines, tightest: 4889 out of 16394 (1 test case)

Test #35:

score: 0
Accepted
time: 766ms
memory: 3712kb

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

Yes
((e&((a&((b&(c|((f&(d|g))|(d&g))))|((f&(c|d))|(c&(d|g)))))|((b&((f&(g|(c&d)))|(c&g)))|(f&(d&(c|g))))))|((a&((b&((c&(d|g))|(d&f)))|(f&(c&(g|d)))))|(b&(f&(d&(c|g))))))
Yes
((e&((g&((f&(c|(d|b)))|((c&(b|(d&a)))|(b&d))))|((f&((a&(d|(c&b)))|(d&(c|b))))|(d&((a&(c|b))|(c&b))))))|((g&((f&((a&(c|b))|(b&d...

result:

ok 65536 lines, tightest: 64 out of 74 (65536 test cases)

Test #36:

score: 0
Accepted
time: 156ms
memory: 3712kb

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

Yes
((d&((g&((h&((b&(f|((e&(a|(j|(i|c))))|(i|((a&(j|c))|(j&c))))))|((f&(e|(a|(j|(i|c)))))|((e&(j|(i|(a&c))))|((a&(j|i))|(j&c))))))|((b&((f&(e|(j|(i|c))))|((e&(i|(c|(a&j))))|((j&(c|(a&i)))|(i&c)))))|((f&((e&(a|(j|i)))|((a&(c|(j&i)))|(i&c))))|((e&((a&(j|c))|(i&(j|c))))|(j&(i&(a|c))))))))|((h&((b&((f&(...

result:

ok 1024 lines, tightest: 375 out of 522 (1024 test cases)

Test #37:

score: 0
Accepted
time: 57ms
memory: 3712kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

Yes
((d&((k&((c&((a&((b&((h&(i|(e|(f|(g|(j|l))))))|((i&(e|(f|(g|(j|l)))))|((e&(f|(g|(j|l))))|(f|(j|(g&l)))))))|((h&((i&(e|(f|(g|(j|l)))))|((e&(f|(g|(j|l))))|(f|(g|(j&l))))))|((i&((e&(f|(g|(j|l))))|(f|(j|l))))|((e&((f&(g|(j|l)))|((g&(j|l))|(j&l))))|((j&(f|l))|(g&l)))))))|((b&((h&((i&(e|(f|(g|(j|l))))...

result:

ok 64 lines, tightest: 1336 out of 2058 (64 test cases)

Test #38:

score: 0
Accepted
time: 51ms
memory: 3968kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

Yes
((e&((h&((d&((i&((l&((g&((f&(c|(k|(a|(j|b)))))|(c|(k|(b|(a&j))))))|((f&(k|(a|(j|b))))|((c&(j|(b|(k&a))))|((k&(j|b))|(a&b))))))|((g&((f&(c|((k&(a|(j|b)))|((a&(j|b))|(j&b)))))|((c&(k|(b|(a&j))))|((a&(j|(k&b)))|(b&j)))))|((f&((k&(a|(j|b)))|((a&(j|b))|(j&b))))|((c&((a&(k|b))|(j&b)))|(k&(j&(a|b))))))...

result:

ok 64 lines, tightest: 1194 out of 2058 (64 test cases)

Test #39:

score: 0
Accepted
time: 44ms
memory: 3840kb

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

Yes
((e&((d&((j&((g&((l&((h&((a&((c&(i|(b|(k|f))))|(b|(f|(i&k)))))|((c&(f|((i&(k|b))|(k&b))))|((i&(b|k))|(k&(f|b))))))|((a&((c&(f|((i&(k|b))|(k&b))))|((b&(k|f))|(i&(k&f)))))|((c&((b&(k|(f&i)))|(i&(k&f))))|(i&(b&(f&k)))))))|((h&((a&((c&(i|((b&(f|k))|(f&k))))|((i&(k|(b&f)))|(k&(b|f)))))|((c&((b&(i|(k|...

result:

ok 64 lines, tightest: 848 out of 2058 (64 test cases)

Test #40:

score: 0
Accepted
time: 27ms
memory: 4096kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

Yes
((n&((f&((m&((a&((l&((d&(g|(b|((k&(h|(e|(j|(i|c)))))|((h&(e|(j|(i|c))))|(j|(c|i)))))))|((g&(b|((k&(h|(e|(j|(i|c)))))|((h&(e|(j|(i|c))))|(j|(i|(e&c)))))))|((b&((k&(h|(e|(j|(i|c)))))|(h|(j|(c|(e&i))))))|((k&(h|(e|((j&(c|i))|(c&i)))))|((h&(e|(j|(c&i))))|((j&(i|(e&c)))|(c&i))))))))|((d&((g&(b|((k&(h...

result:

ok 4 lines, tightest: 4911 out of 8202 (4 test cases)

Test #41:

score: 0
Accepted
time: 26ms
memory: 3712kb

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

Yes
((a&((g&((c&((k&((d&((n&((l&(j|(i|(e|(h|(f|b))))))|((m&(j|((i&(e|(h|(f|b))))|((e&(h|(f|b)))|((h&(f|b))|(f&b))))))|((j&((i&(e|(h|(f|b))))|(h|(b|(e&f)))))|((i&(f|(b|(e&h))))|((h&(b|(e&f)))|(b&f)))))))|((l&((m&(j|((i&(e|(h|(f|b))))|(f|(b|(e&h))))))|((j&(i|(e|(h|(f|b)))))|((i&(h|(f|(e&b))))|((e&(f|b...

result:

ok 4 lines, tightest: 4411 out of 8202 (4 test cases)

Test #42:

score: 0
Accepted
time: 22ms
memory: 4352kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

Yes
((o&((n&((m&((k&((a&((j&((c&(d|(f|(g|(b|(h|(i|(l|e))))))))|(d|(f|((g&(b|(h|(i|(l|e)))))|(b|((h&(l|(i|e)))|((l&(i|e))|(i&e)))))))))|((c&((d&(f|(g|(b|(h|(i|(l|e)))))))|(f|((g&(b|(h|(i|(l|e)))))|(b|(i|(e|(h&l))))))))|((d&((f&(g|(b|(h|(i|(l|e))))))|(g|((b&(h|(i|(l|e))))|(h|(l|(i&e)))))))|((f&(b|(h|(...

result:

ok 1 lines, tightest: 9255 out of 16394 (1 test case)

Test #43:

score: 0
Accepted
time: 20ms
memory: 4352kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((f&((g&((e&((l&((o&((k&((a&((m&(n|(b|(j|(c|(d|(i|h)))))))|(b|(j|(c|(d|(i|h)))))))|((m&((n&(b|(j|(c|(d|(i|h))))))|((b&(j|(c|(d|(i|h)))))|((j&(c|(d|(i|h))))|(c|(i|(d&h)))))))|((n&((b&(j|(c|(d|(i|h)))))|((j&(c|(d|(i|h))))|(c|(i|(d&h))))))|((b&(j|(c|(i|(d&h)))))|((j&(d|(h|(c&i))))|((c&(d|(i|h)))|(d...

result:

ok 1 lines, tightest: 9133 out of 16394 (1 test case)

Test #44:

score: 0
Accepted
time: 20ms
memory: 4224kb

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
((c&((b&((i&((k&((j&((o&((l&((a&(f|(h|(m|(e|(g|n))))))|((d&(f|(h|(e|(g|n)))))|((f&((h&(m|(e|(g|n))))|(e|(g|(m&n)))))|((h&(m|((e&(n|g))|(n&g))))|((e&(n|(m&g)))|(g&n)))))))|((a&((d&((f&(h|(m|(e|(g|n)))))|((h&(m|(e|(g|n))))|(m|(g|n)))))|((f&(h|(n|((m&(g|e))|(g&e)))))|((h&(m|(e|(g|n))))|((m&(e|g))|(...

result:

ok 1 lines, tightest: 7485 out of 16394 (1 test case)

Extra Test:

score: 0
Extra Test Passed