QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#861092#9980. Boolean Function Reconstructionucup-team055#AC ✓545ms4096kbC++268.4kb2025-01-18 16:09:452025-01-18 16:09:45

Judging History

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

  • [2025-01-18 16:09:45]
  • 评测
  • 测评结果:AC
  • 用时:545ms
  • 内存:4096kb
  • [2025-01-18 16:09:45]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
namespace{
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tuplis = array<ll, 3>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF=0x1fffffffffffffff;
const ll MINF=0x7fffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
const int MODD=998244353;
const ld DINF=INFINITY;
const ld EPS=1e-9;
const ld PI=3.14159265358979323846;
const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
#define overload5(a,b,c,d,e,name,...) name
#define overload4(a,b,c,d,name,...) name
#define overload3(a,b,c,name,...) name
#define rep1(n) rep2(_,n)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i=n;i--;)
#define rrep2(i,n) for(ll i=n;i--;)
#define rrep3(i,a,b) for(ll i=b;i-->(a);)
#define rrep4(i,a,b,c) for(ll i=(a)+((b)-(a)-1)/(c)*(c);i>=(a);i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define each1(i,a) for(auto&&i:a)
#define each2(x,y,a) for(auto&&[x,y]:a)
#define each3(x,y,z,a) for(auto&&[x,y,z]:a)
#define each4(w,x,y,z,a) for(auto&&[w,x,y,z]:a)
#define each(...) overload5(__VA_ARGS__,each4,each3,each2,each1)(__VA_ARGS__)
#define all1(i) begin(i),end(i)
#define all2(i,a) begin(i),begin(i)+a
#define all3(i,a,b) begin(i)+a,begin(i)+b
#define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__)
#define rall1(i) rbegin(i),rend(i)
#define rall2(i,a) rbegin(i),rbegin(i)+a
#define rall3(i,a,b) rbegin(i)+a,rbegin(i)+b
#define rall(...) overload3(__VA_ARGS__,rall3,rall2,rall1)(__VA_ARGS__)
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define Msum(...) accumulate(all(__VA_ARGS__),mint{})
#define elif else if
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type>name(__VA_ARGS__)
#define VEC(type,name,size) vector<type>name(size);in(name)
#define vv(type,name,h,...) vector name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector name(h,vector<type>(w));in(name)
#define vvv(type,name,h,w,...) vector name(h,vector(w,vector<type>(__VA_ARGS__)))
template<class T> ll sz(const T& a){ return size(a); }
template<class T, class U> ll count(const T& a, const U& b){ return count(all(a), b); }
template<class T, class F> ll count_if(const T& a, F b){ return count_if(all(a), b); }
template<class T, class F> void filter(T& a, F b){ a.erase(remove_if(all(a), not_fn(b)), a.end()); }
template<class T, class F = less<>> void sor(T& a, F b = F{}){ sort(all(a), b); }
template<class T> void rev(T& a){ reverse(all(a)); }
template<class T> void uniq(T& a){ sor(a); a.erase(unique(all(a)), end(a)); }
ll popcnt(ull a){ return __builtin_popcountll(a); }
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T> T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); }
template<class T> T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); }
template<class T> bool chmin(T& a, const T& b){ return a > b ? a = b, 1 : 0; }
template<class T> bool chmax(T& a, const T& b){ return a < b ? a = b, 1 : 0; }
template<class T, class U> bool chmin(T& a, const U& b){ return a > b ? a = b, 1 : 0; }
template<class T, class U> bool chmax(T& a, const U& b){ return a < b ? a = b, 1 : 0; }
vector<ll> iota(ll n, ll begin = 0){ vector<ll> a(n); iota(a.begin(), a.end(), begin); return a; }
vector<pll> factor(ull x){ vector<pll> ans; for(ull i = 2; i * i <= x; i++) if(x % i == 0){ ans.push_back({i, 1}); while((x /= i) % i == 0) ans.back().second++; } if(x != 1) ans.push_back({x, 1}); return ans; }
vector<ll> divisor(ull x){ vector<ll> ans; for(ull i = 1; i * i <= x; i++) if(x % i == 0) ans.push_back(i); rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]); return ans; }
template<class T> unordered_map<T, ll> press(vector<T> a){ uniq(a); unordered_map<T, ll> ans; rep(i, a.size()) ans[a[i]] = i; return ans; }
template<class T> auto run_press(const T& a){ vector<pair<decay_t<decltype(a[0])>, ll>> ans; each(x, a){ if(ans.empty() || ans.back().first != x) ans.emplace_back(x, 1); else ans.back().second++; } return ans; }
template<class... Ts> void in(Ts&... t);
[[maybe_unused]] void print(){}
template<class T, class... Ts> void print(const T& t, const Ts&... ts);
template<class... Ts> void out(const Ts&... ts){ print(ts...); cout << '\n'; }
namespace IO{
#define VOID(a) decltype(void(a))
struct S{ S(){ cin.tie(nullptr)->sync_with_stdio(0); fixed(cout).precision(12); } }S;
template<int I> struct P : P<I-1>{};
template<> struct P<0>{};
template<class T> void i(T& t){ i(t, P<3>{}); }
void i(vector<bool>::reference t, P<3>){ int a; i(a); t = a; }
template<class T> auto i(T& t, P<2>) -> VOID(cin >> t){ cin >> t; }
template<class T> auto i(T& t, P<1>) -> VOID(begin(t)){ for(auto&& x : t) i(x); }
template<class T, size_t... idx> void ituple(T& t, index_sequence<idx...>){ in(get<idx>(t)...); }
template<class T> auto i(T& t, P<0>) -> VOID(tuple_size<T>{}){ ituple(t, make_index_sequence<tuple_size<T>::value>{}); }
template<class T> void o(const T& t){ o(t, P<4>{}); }
template<size_t N> void o(const char (&t)[N], P<4>){ cout << t; }
template<class T, size_t N> void o(const T (&t)[N], P<3>){ o(t[0]); for(size_t i = 1; i < N; i++){ o(' '); o(t[i]); } }
template<class T> auto o(const T& t, P<2>) -> VOID(cout << t){ cout << t; }
template<class T> auto o(const T& t, P<1>) -> VOID(begin(t)){ bool first = 1; for(auto&& x : t) { if(first) first = 0; else o(' '); o(x); } }
template<class T, size_t... idx> void otuple(const T& t, index_sequence<idx...>){ print(get<idx>(t)...); }
template<class T> auto o(T& t, P<0>) -> VOID(tuple_size<T>{}){ otuple(t, make_index_sequence<tuple_size<T>::value>{}); }
#undef VOID
}
#define unpack(a) (void)(0 + ... + (a, 0))
template<class... Ts> void in(Ts&... t){ unpack(IO::i(t)); }
template<class T, class... Ts> void print(const T& t, const Ts&... ts){ IO::o(t); unpack(IO::o((cout << ' ', ts))); }
#undef unpack
#ifdef DEBUG
ll __lg(ull x){ return 63 - __builtin_clzll(x); }
#define debug(...) { print(#__VA_ARGS__); print(":"); out(__VA_ARGS__); }
#else
#define debug(...) void(0)
#endif
#define YESNO(yes,no) void yes(bool i = 1){ out(i?#yes:#no); } void no(){ out(#no); }
YESNO(first, second)
YESNO(First, Second)
YESNO(Yes, No)
YESNO(YES, NO)
YESNO(possible, impossible)
YESNO(Possible, Impossible)
YESNO(POSSIBLE, IMPOSSIBLE)



void solve(){
    LL(n);
    STR(s);
    rep(bit,1<<n)rep(i,n)if(s[bit]>s[bit|1<<i])return No();
    Yes();
    if(s[0]=='1'){
        return out("T");
    }
    if(s.back()=='0'){
        return out("F");
    }
    vector<int>f;
    rep(bit,1<<n)if(s[bit]=='1'&&[&]()->bool{
        rep(i,n){
            if(bit&1<<i&&s[bit^1<<i]=='1')return 0;
        }
        return 1;
    }())f.push_back(bit);
    auto dfs=[&](auto dfs,vector<int> f)->string{
        vector<int> cnt(n);
        each(x,f)rep(i,n)if(x&1<<i)cnt[i]++;
        const ll i=ranges::max_element(cnt)-begin(cnt);
        const char c='a'+i;
        if(cnt[i]==sz(f)){
            each(x,f)x&=~(1<<i);
            if(f==vector{0})return string(1,c);
            return "("s + c + "&"s + dfs(dfs,f) + ")";
        }
        vector<int>g;
        erase_if(f,[&](ll x){
            if(x&1<<i){
                g.push_back(x&~(1<<i));
                return 1;
            }
            return 0;
        });
        if(g==vector{0})return "("s + c + "|" + dfs(dfs,f) + ")";
        return "(("s + c + "&" + dfs(dfs,g) + ")|" + dfs(dfs,f) + ")";
    };
    out(dfs(dfs,f));
}
}
int main(){
    ll t = 1;
    in(t); // マルチテストケースかどうか確認!
    rep(i,t){
        solve();
    }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

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

Test #2:

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

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: 0ms
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
(a|b)
Yes
T

result:

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

Test #4:

score: 0
Accepted
time: 0ms
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: 7ms
memory: 3584kb

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: 0ms
memory: 3712kb

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&(b&(c&d)))
Yes
(b&(c&d))
Yes
(a&(c&d))
Yes
(c&(d&(a|b)))
Yes
(c&d)
Yes
(a&(b&d))
Yes
(b&(d&(a|c)))
Yes
(a&(d&(b|c)))
Yes
(d&((a&(b|c))|(b&c)))
Yes
(d&((a&b)|c))
Yes
(b&d)
Yes
(d&((a&c)|b))
Yes
(d&(b|c))
Yes
(a&d)
Yes
(d&(a|(b&c)))
Yes
(d&(a|c))
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: 10ms
memory: 3456kb

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&(b&(c&(d&e))))
Yes
(b&(c&(d&e)))
Yes
(a&(c&(d&e)))
Yes
(c&(d&(e&(a|b))))
Yes
(c&(d&e))
Yes
(a&(b&(d&e)))
Yes
(b&(d&(e&(a|c))))
Yes
(a&(d&(e&(b|c))))
Yes
(d&(e&((a&(b|c))|(b&c))))
Yes
(d&(e&((a&b)|c)))
Yes
(b&(d&e))
Yes
(d&(e&((a&c)|b)))
Yes
(d&(e&(b|c)))
Yes
(a&(d&e))
Yes
(d&(e&(a|(b&c)...

result:

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

Test #8:

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

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
((a&(b|c))|(b&c))
Yes
((a&(b|(c|d)))|((b&(c|d))|(c&d)))
Yes
((a&((b&(c|(d|e)))|((c&(d|e))|(d&e))))|((b&((c&(d|e))|(d&e)))|(c&(d&e))))
Yes
((a&((b&(c|(d|(e|f))))|((c&(d|(e|f)))|((d&(e|f))|(e&f)))))|((b&((c&(d|(e|f)))|((d&(e|f))|(e&f))))|((c&((d&(e|f))|(e&f)))|(d&(e&f)))))
Yes
((a&...

result:

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

Test #9:

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

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&((b&(c|d))|(c&d)))|(b&(c&d)))
Yes
((a&((b&(c|(d|e)))|((c&(d|e))|(d&e))))|((b&((c&(d|e))|(d&e)))|(c&(d&e))))
Yes
((a&((b&((c&(d|(e|f)))|((d&(e|f))|(e&f))))|((c&((d&(e|f))|(e&f)))|(d&(e&f)))))|((b&((c&((d&(e|f))|(e&f)))|(d&(e&f))))|(c&(d&(e&f)))))
Yes
((a&...

result:

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

Test #10:

score: 0
Accepted
time: 4ms
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
(a&(b&c))
Yes
((a&((b&(c|d))|(c&d)))|(b&(c&d)))
Yes
((a&((b&((c&(d|e))|(d&e)))|(c&(d&e))))|(b&(c&(d&e))))
Yes
((a&((b&((c&(d|(e|f)))|((d&(e|f))|(e&f))))|((c&((d&(e|f))|(e&f)))|(d&(e&f)))))|((b&((c&((d&(e|f))|(e&f)))|(d&(e&f))))|(c&(d&(e&f)))))
Yes
((a&((b&((c&((d&(e|(f|g)))|((e&(...

result:

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

Test #11:

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

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&(b&c))
Yes
(a&(b&(c&d)))
Yes
((a&((b&((c&(d|e))|(d&e)))|(c&(d&e))))|(b&(c&(d&e))))
Yes
((a&((b&((c&((d&(e|f))|(e&f)))|(d&(e&f))))|(c&(d&(e&f)))))|(b&(c&(d&(e&f)))))
Yes
((a&((b&((c&((d&(e|(f|g)))|((e&(f|g))|(f&g))))|((d&((e&(f|g))|(f&g)))|(e&(f&g)))))|((c&((d&((e&(f|g))|(f&g)))|(e...

result:

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

Test #12:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #13:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #14:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #15:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #16:

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

input:

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

output:

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

result:

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

Test #17:

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

input:

65536
7
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
7
00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111
7
000000010001001100000001001101...

output:

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

result:

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

Test #18:

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

input:

16384
8
0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111
8
000101010101011100010101011101110...

output:

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

result:

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

Test #19:

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

input:

4096
9
00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...

output:

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

result:

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

Test #20:

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

input:

1024
10
0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...

output:

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

result:

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

Test #21:

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

input:

256
11
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #22:

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

input:

64
12
000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...

output:

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

result:

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

Test #23:

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

input:

16
13
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...

output:

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

result:

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

Test #24:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #25:

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

input:

4
14
0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...

output:

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

result:

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

Test #26:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #27:

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

input:

4
14
0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...

output:

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

result:

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

Test #28:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #29:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #30:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #31:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #32:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...

output:

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

result:

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

Test #33:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #34:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...

output:

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

result:

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

Test #35:

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

input:

65536
7
00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111
7
00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111
7
000000000000000000000001000100...

output:

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

result:

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

Test #36:

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

input:

1024
10
0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...

output:

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

result:

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

Test #37:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...

output:

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

result:

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

Test #38:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #39:

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

input:

64
12
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...

output:

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

result:

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

Test #40:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...

output:

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

result:

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

Test #41:

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

input:

4
14
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #42:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...

output:

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

result:

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

Test #43:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Test #44:

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

input:

1
15
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

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

result:

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

Extra Test:

score: 0
Extra Test Passed