QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#862528 | #9980. Boolean Function Reconstruction | ucup-team1134# | TL | 1942ms | 15732kb | C++23 | 10.7kb | 2025-01-19 02:34:56 | 2025-01-19 02:34:56 |
Judging History
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(MA.count(S)) return MA[S];
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 MA[S]=aa;
}
auto aa=DFS(A,u-1),bb=DFS(B,u-1);
if(aa=="F"){
return MA[S]=bb;
}
if(aa=="T"){
if(bb=="T"){
return MA[S]="T";
}
if(bb=="F"){
return MA[S]=string(1,char('a'+u));
}
string Z;
Z+='(';
Z+=char('a'+u);
Z+='|';
Z+=bb;
Z+=')';
return MA[S]=Z;
}
if(bb=="F"){
string Z;
Z+='(';
Z+=char('a'+u);
Z+='&';
Z+=aa;
Z+=')';
return MA[S]=Z;
}
if(bb=="T"){
return "T";
}
string Z;
Z+='(';
Z+='(';
Z+=char('a'+u);
Z+='&';
Z+=aa;
Z+=')';
Z+='|';
Z+=bb;
Z+=')';
return MA[S]=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=solve(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;
}
}
}
}
}
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 (b&a) Yes (b|a) Yes T Yes ((a&(b|c))|(b&c)) No Yes a Yes (d&(a&(c&(b&e))))
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: 13ms
memory: 3840kb
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 (b&a) 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: 3840kb
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: 36ms
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: 14ms
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 (b&(c&(d&a))) Yes (d&(b&c)) Yes (c&(d&a)) Yes (d&(c&(b|a))) Yes (d&c) Yes (b&(a&d)) Yes (d&(b&(c|a))) Yes (a&(d&(b|c))) Yes (d&((c&(a|b))|(a&b))) Yes (d&(c|(b&a))) Yes (d&b) Yes (d&(b|(c&a))) Yes (d&(c|b)) Yes (d&a) Yes (d&(a|(b&c))) Yes (d&(c|a)) Yes (d&(a|b)) Yes (d&(a|(b|c))) Yes d Yes ...
result:
ok 168 lines, tightest: 8 out of 18 (168 test cases)
Test #7:
score: 0
Accepted
time: 93ms
memory: 4736kb
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&(d&(e&(b&c)))) Yes (e&(b&(c&d))) Yes (e&(d&(a&c))) Yes ((b&(e&(c&d)))|(a&(e&(c&d)))) Yes (c&(e&d)) Yes (d&(e&(b&a))) Yes ((c&(d&(e&b)))|(d&(e&(a&b)))) Yes (e&(d&(a&(c|b)))) Yes (e&(d&((b&(a|c))|(a&c)))) Yes ((a&(d&(e&(c|b))))|(d&(c&e))) Yes (d&(b&e)) Yes ((b&(e&d))|(c&(e&(a&d)))) Yes (e...
result:
ok 7581 lines, tightest: 18 out of 26 (7581 test cases)
Test #8:
score: 0
Accepted
time: 62ms
memory: 9148kb
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 ((d&(a|(b|c)))|((a&(b|c))|(b&c))) Yes ((b&((d&(c|(e|a)))|((c&(e|a))|(e&a))))|((c&((d&(e|a))|(e&a)))|(d&(e&a)))) Yes ((e&((d&(c|(a|(f|b))))|((a&(c|(f|b)))|((c&(f|b))|(f&b)))))|((d&((a&(c|(f|b)))|((c&(f|b))|(f&b))))|((c&((a&(f|b))|(f&b)))|(a&(f&b))))) Yes ((d&...
result:
ok 14 lines, tightest: 68 out of 74 (14 test cases)
Test #9:
score: 0
Accepted
time: 54ms
memory: 7112kb
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 ((b&((d&(a|c))|(a&c)))|(d&(a&c))) Yes ((d&((c&(a|(b|e)))|((a&(b|e))|(b&e))))|((c&((a&(b|e))|(b&e)))|(a&(b&e)))) Yes ((b&((a&((f&(d|(e|c)))|((d&(e|c))|(e&c))))|((f&((d&(e|c))|(e&c)))|(d&(e&c)))))|((a&((f&((d&(e|c))|(e&c)))|(d&(e&c))))|(f&(d&(e&c))))) Yes ((d&...
result:
ok 14 lines, tightest: 68 out of 74 (14 test cases)
Test #10:
score: 0
Accepted
time: 48ms
memory: 7296kb
input:
14 1 00 2 0001 3 00000001 4 0000000100010111 5 00000000000000010000000100010111 6 0000000000000001000000010001011100000001000101110001011101111111 7 00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111 8 00000000000000000000...
output:
Yes F Yes (b&a) Yes (a&(b&c)) Yes ((a&((b&(d|c))|(d&c)))|(b&(d&c))) Yes ((e&((b&((c&(d|a))|(d&a)))|(c&(d&a))))|(b&(c&(d&a)))) Yes ((d&((a&((b&(e|(c|f)))|((e&(c|f))|(c&f))))|((b&((e&(f|c))|(f&c)))|(e&(f&c)))))|((a&((b&((e&(f|c))|(f&c)))|(e&(f&c))))|(b&(e&(f&c))))) Yes ((e&((g&((c&((b&(d|(a|f)))|((d&(...
result:
ok 14 lines, tightest: 33 out of 42 (14 test cases)
Test #11:
score: 0
Accepted
time: 37ms
memory: 5940kb
input:
14 1 00 2 0000 3 00000001 4 0000000000000001 5 00000000000000010000000100010111 6 0000000000000000000000000000000100000000000000010000000100010111 7 00000000000000000000000000000001000000000000000100000001000101110000000000000001000000010001011100000001000101110001011101111111 8 00000000000000000000...
output:
Yes F Yes F Yes (c&(a&b)) Yes (b&(d&(c&a))) Yes ((a&((d&((b&(e|c))|(e&c)))|(b&(e&c))))|(d&(b&(c&e)))) Yes ((b&((e&((f&((d&(c|a))|(c&a)))|(d&(c&a))))|(f&(d&(a&c)))))|(e&(f&(d&(a&c))))) Yes ((d&((e&((b&((c&(a|(f|g)))|((a&(f|g))|(f&g))))|((c&((f&(a|g))|(a&g)))|(f&(a&g)))))|((b&((c&((f&(a|g))|(a&g)))|(f...
result:
ok 14 lines, tightest: 0 out of 11 (14 test cases)
Test #12:
score: 0
Accepted
time: 68ms
memory: 11796kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...
output:
Yes ((m&((o&((a&((l&((f&((i&((k&(g|(d|(c|(j|(b|(n|(e|h))))))))|((g&(d|(c|(j|(b|(n|(e|h)))))))|((d&(c|(j|(b|(n|(e|h))))))|((c&(j|(b|(n|(e|h)))))|((j&(b|(n|(e|h))))|((b&(e|(n|h)))|((e&(n|h))|(n&h)))))))))|((k&((g&(d|(c|(j|(b|(n|(e|h)))))))|((d&(c|(j|(b|(n|(e|h))))))|((c&(j|(b|(n|(e|h)))))|((j&(b|(n|(e...
result:
ok 1 lines, tightest: 12868 out of 16394 (1 test case)
Test #13:
score: 0
Accepted
time: 94ms
memory: 15732kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...
output:
Yes ((g&((m&((e&((k&((d&((o&(c|(i|(a|(f|(l|(j|(b|(h|n)))))))))|((c&(i|(a|(f|(l|(j|(b|(h|n))))))))|((i&(a|(f|(l|(j|(b|(h|n)))))))|((a&(f|(l|(j|(b|(h|n))))))|((f&(l|(j|(b|(h|n)))))|((l&(j|(b|(h|n))))|((j&(b|(h|n)))|((b&(h|n))|(h&n))))))))))|((o&((c&(i|(a|(f|(l|(j|(b|(h|n))))))))|((i&(a|(f|(l|(j|(b|(h|...
result:
ok 1 lines, tightest: 11438 out of 16394 (1 test case)
Test #14:
score: 0
Accepted
time: 50ms
memory: 9464kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes ((k&((d&((f&((n&((a&((e&((l&((b&(o|(m|(h|(j|(c|(g|i)))))))|((o&(m|(h|(j|(c|(g|i))))))|((m&(h|(j|(c|(g|i)))))|((h&(j|(c|(g|i))))|((j&(c|(i|g)))|((c&(i|g))|(i&g))))))))|((b&((o&(m|(h|(j|(c|(g|i))))))|((m&(h|(j|(c|(g|i)))))|((h&(j|(c|(g|i))))|((j&(c|(i|g)))|((c&(i|g))|(i&g)))))))|((o&((m&(h|(j|(c|(...
result:
ok 1 lines, tightest: 11438 out of 16394 (1 test case)
Test #15:
score: 0
Accepted
time: 41ms
memory: 6784kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes ((o&((m&((n&((d&((e&((b&((j&((h&((a&(l|(g|(k|(i|(c|f))))))|((l&(g|(k|(i|(c|f)))))|((g&(k|(i|(c|f))))|((k&(i|(c|f)))|((i&(c|f))|(c&f)))))))|((a&((l&(g|(k|(i|(c|f)))))|((g&(k|(i|(c|f))))|((k&(i|(c|f)))|((i&(c|f))|(c&f))))))|((l&((g&(k|(i|(c|f))))|((k&(i|(c|f)))|((i&(c|f))|(c&f)))))|((g&((k&(i|(c|f...
result:
ok 1 lines, tightest: 8006 out of 16394 (1 test case)
Test #16:
score: 0
Accepted
time: 1942ms
memory: 14848kb
input:
65536 6 0000001101111111000111111111111101111111111111111111111111111111 6 0000000000000000000100110011011100000000000000000001001100111111 6 0101010101110111011101111111111101110111111111111111111111111111 6 0000001100000011000000110001011100011111001111110011111100111111 6 000000010001011100000001...
output:
Yes ((e&(f|(c|(d|(a&b)))))|((f&(a|(b|(c|d))))|((b&(c|d))|(d&(a|c))))) Yes ((c&((f&(e&(b|d)))|(e&(b|(a&d)))))|(b&(e&(a|d)))) Yes ((f&(b|(e|(a|d))))|((b&(e|(a|d)))|(a|(e&d)))) Yes ((b&((f&(c|(d|(a|e))))|(c|(d&(a&e)))))|((f&c)|(c&(d&(a&e))))) Yes ((f&((b&(a|(d|c)))|(a&c)))|((b&((a&(d|c))|(d&c)))|(a&(d&...
result:
ok 65536 lines, tightest: 36 out of 42 (65536 test cases)
Test #17:
score: -100
Time Limit Exceeded
input:
65536 7 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 7 00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111 7 000000010001001100000001001101...
output:
Yes (g&(c&(e&(b&(a&(d&f)))))) Yes ((b&((c&(a|((e&(g|(f|d)))|(d&(f|g)))))|((a&(g|(e|(d|f))))|((e&(g|(f|d)))|(d&(f|g))))))|((c&((a&((e&(g|(f|d)))|(d&(f|g))))|(e&(d&(g|f)))))|((a&((e&(g|(f|d)))|(d&(f|g))))|(g&(e&(f&d)))))) Yes ((g&((f&((e&(b|(d|(c&a))))|((b&(c|(a|d)))|(d&(a|c)))))|((e&((c&(b|(d&a)))|(d...