QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#861479 | #9980. Boolean Function Reconstruction | ucup-team087# | AC ✓ | 1192ms | 4352kb | C++14 | 3.9kb | 2025-01-18 17:38:23 | 2025-01-18 17:38:36 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
int N;
char S[(1 << 15) + 10];
string rec(const vector<int> &us) {
if (us.size() == 0) {
return "F";
}
if (us.size() == 1) {
string ret = "T";
for (int e = 0; e < N; ++e) if (us[0] & 1 << e) {
const char c = 'a' + e;
if (ret == "T") {
ret = string() + c;
} else {
ret = "(" + ret + "&" + c + ")";
}
}
return ret;
}
vector<int> freq(N, 0);
for (const int u : us) {
for (int e = 0; e < N; ++e) if (u & 1 << e) ++freq[e];
}
int em = 0;
for (int e = 0; e < N; ++e) if (freq[em] < freq[e]) em = e;
assert(freq[em]);
vector<int> uss[2];
for (const int u : us) uss[u >> em & 1].push_back(u & ~(1 << em));
string res0 = rec(uss[0]);
string res1 = rec(uss[1]);
const char cm = 'a' + em;
res1 = (res1 == "T") ? (string() + cm) : (string() + "(" + cm + "&" + res1 + ")");
if (uss[0].size()) {
if (uss[1].size()) {
return "(" + res0 + "|" + res1 + ")";
} else {
return res0;
}
} else {
if (uss[1].size()) {
return res1;
} else {
assert(false);
}
}
}
string solve() {
vector<int> us;
for (int u = 0; u < 1 << N; ++u) if (S[u] == '1') {
bool ok = true;
for (int e = 0; e < N; ++e) if (u & 1 << e) ok = ok && (S[u ^ 1 << e] == '0');
if (ok) {
us.push_back(u);
}
}
// cerr<<"us = "<<us<<endl;
if (us == vector<int>{0}) return "T";
const string ans = rec(us);
return ans;
}
void flip() {
for (int u = 0; u < 1 << N; ++u) S[u] ^= 1;
reverse(S, S + (1 << N));
}
int main() {
for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
scanf("%d", &N);
scanf("%s", S);
bool mono = true;
for (int u = 0; u < 1 << N; ++u) if (S[u] == '1') {
for (int e = 0; e < N; ++e) if (!(u & 1 << e)) {
mono = mono && (S[u | 1 << e] == '1');
}
}
if (!mono) {
puts("No");
continue;
}
string ans[2];
ans[0] = solve();
flip();
ans[1] = solve();
flip();
for (char &c : ans[1]) {
if (c == 'T' || c == 'F') c ^= 'T' ^ 'F';
if (c == '&' || c == '|') c ^= '&' ^ '|';
}
// for(int h=0;h<2;++h)cerr<<"ans["<<h<<"] = "<<ans[h]<<endl;
int cost[2] = {};
for (int h = 0; h < 2; ++h) {
for (const char c : ans[h]) {
if (c == '&' || c == '|') ++cost[h];
}
}
int hm = 0;
for (int h = 0; h < 2; ++h) if (cost[hm] > cost[h]) hm = h;
puts("Yes");
puts(ans[hm].c_str());
}
#ifndef LOCAL
break;
#endif
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3968kb
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&c)|(a&(c|b))) 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: 3968kb
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: 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 (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: 0ms
memory: 3968kb
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: 15ms
memory: 3968kb
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: 3968kb
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&(b|a))) Yes (c&d) Yes ((a&b)&d) Yes (b&(d&(c|a))) Yes (a&(d&(c|b))) Yes (d&((b&c)|(a&(c|b)))) Yes (d&(c|(a&b))) Yes (b&d) Yes (d&(b|(a&c))) Yes (d&(c|b)) Yes (a&d) Yes (d&((b&c)|a)) Yes (d&(c|a)) Yes (d&(b|a)) Yes (d&((c|b)|a)) Yes d Yes ...
result:
ok 168 lines, tightest: 8 out of 18 (168 test cases)
Test #7:
score: 0
Accepted
time: 22ms
memory: 3968kb
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&(b|a)))) Yes ((c&d)&e) Yes (((a&b)&d)&e) Yes (b&(d&(e&(c|a)))) Yes (a&(d&(e&(c|b)))) Yes (d&(e&((b&c)|(a&(c|b))))) Yes (d&(e&(c|(a&b)))) Yes ((b&d)&e) Yes (d&(e&(b|(a&c)))) Yes (d&(e&(c|b))) Yes ((a&d)&e) Yes (d&(e&((b&c)|a...
result:
ok 7581 lines, tightest: 18 out of 26 (7581 test cases)
Test #8:
score: 0
Accepted
time: 10ms
memory: 4224kb
input:
14 1 01 2 0111 3 00010111 4 0001011101111111 5 00000001000101110001011101111111 6 0000000100010111000101110111111100010111011111110111111111111111 7 00000000000000010000000100010111000000010001011100010111011111110000000100010111000101110111111100010111011111110111111111111111 8 00000000000000010000...
output:
Yes a Yes (b|a) Yes ((b&c)|(a&(c|b))) Yes (((c&d)|(b&(d|c)))|(a&((d|c)|b))) Yes ((((c&d)&e)|(b&((d&e)|(c&(e|d)))))|(a&(((d&e)|(c&(e|d)))|(b&((e|d)|c))))) Yes (((((d&e)&f)|(c&((e&f)|(d&(f|e)))))|(b&(((e&f)|(d&(f|e)))|(c&((f|e)|d)))))|(a&((((e&f)|(d&(f|e)))|(c&((f|e)|d)))|(b&(((f|e)|d)|c))))) Yes ((((...
result:
ok 14 lines, tightest: 68 out of 74 (14 test cases)
Test #9:
score: 0
Accepted
time: 11ms
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 ((b&c)|(a&(c|b))) Yes (((b&c)&d)|(a&((c&d)|(b&(d|c))))) Yes ((((c&d)&e)|(b&((d&e)|(c&(e|d)))))|(a&(((d&e)|(c&(e|d)))|(b&((e|d)|c))))) Yes (((((c&d)&e)&f)|(b&(((d&e)&f)|(c&((e&f)|(d&(f|e)))))))|(a&((((d&e)&f)|(c&((e&f)|(d&(f|e)))))|(b&(((e&f)|(d&(f|e)))|(c&((f|e)|d))))))) Yes ((((...
result:
ok 14 lines, tightest: 68 out of 74 (14 test cases)
Test #10:
score: 0
Accepted
time: 11ms
memory: 4096kb
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 (((b&c)&d)|(a&((c&d)|(b&(d|c))))) Yes ((((b&c)&d)&e)|(a&(((c&d)&e)|(b&((d&e)|(c&(e|d))))))) Yes (((((c&d)&e)&f)|(b&(((d&e)&f)|(c&((e&f)|(d&(f|e)))))))|(a&((((d&e)&f)|(c&((e&f)|(d&(f|e)))))|(b&(((e&f)|(d&(f|e)))|(c&((f|e)|d))))))) Yes ((((((c&d)&e)&f)&g)|(b&((((d&e)&...
result:
ok 14 lines, tightest: 33 out of 42 (14 test cases)
Test #11:
score: 0
Accepted
time: 9ms
memory: 4224kb
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 ((((b&c)&d)&e)|(a&(((c&d)&e)|(b&((d&e)|(c&(e|d))))))) Yes (((((b&c)&d)&e)&f)|(a&((((c&d)&e)&f)|(b&(((d&e)&f)|(c&((e&f)|(d&(f|e))))))))) Yes ((((((c&d)&e)&f)&g)|(b&((((d&e)&f)&g)|(c&(((e&f)&g)|(d&((f&g)|(e&(g|f)))))))))|(a&(((((d&e)&f)&g)|(c&(((e&f)&g)|...
result:
ok 14 lines, tightest: 0 out of 11 (14 test cases)
Test #12:
score: 0
Accepted
time: 11ms
memory: 4224kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...
output:
Yes ((((((((((((((h&i)&j)&k)&l)&m)&n)&o)|(g&(((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((n&o)|(m&(o|n)))))))))))))))|(f&((((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((...
result:
ok 1 lines, tightest: 12868 out of 16394 (1 test case)
Test #13:
score: 0
Accepted
time: 11ms
memory: 4352kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000100000000000000010000000100010111000000000000000000000000000000000000000...
output:
Yes ((((((((((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((n&o)|(m&(o|n)))))))))))))|(g&(((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((n&o)|(m&(o|n)))))))))))|(h&((((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|...
result:
ok 1 lines, tightest: 11438 out of 16394 (1 test case)
Test #14:
score: 0
Accepted
time: 10ms
memory: 4224kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes ((((((((((((((g&h)&i)&j)&k)&l)&m)&n)&o)|(f&((((((((h&i)&j)&k)&l)&m)&n)&o)|(g&(((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((n&o)|(m&(o|n)))))))))))))))))|(e&(((((((((h&i)&j)&k)&l)&m)&n)&o)|(g&(((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k...
result:
ok 1 lines, tightest: 11438 out of 16394 (1 test case)
Test #15:
score: 0
Accepted
time: 7ms
memory: 4096kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes ((((((((((((((f&g)&h)&i)&j)&k)&l)&m)&n)&o)|(e&(((((((((g&h)&i)&j)&k)&l)&m)&n)&o)|(f&((((((((h&i)&j)&k)&l)&m)&n)&o)|(g&(((((((i&j)&k)&l)&m)&n)&o)|(h&((((((j&k)&l)&m)&n)&o)|(i&(((((k&l)&m)&n)&o)|(j&((((l&m)&n)&o)|(k&(((m&n)&o)|(l&((n&o)|(m&(o|n)))))))))))))))))))|(d&((((((((((g&h)&i)&j)&k)&l)&m)&n...
result:
ok 1 lines, tightest: 8006 out of 16394 (1 test case)
Test #16:
score: 0
Accepted
time: 409ms
memory: 3968kb
input:
65536 6 0000001101111111000111111111111101111111111111111111111111111111 6 0000000000000000000100110011011100000000000000000001001100111111 6 0101010101110111011101111111111101110111111111111111111111111111 6 0000001100000011000000110001011100011111001111110011111100111111 6 000000010001011100000001...
output:
Yes ((((c&e)|(b&(c|(a&e))))|(f&(((e|c)|b)|a)))|(d&((((f|e)|c)|b)|a))) Yes (e&((c&(d&(f|a)))|(b&((d|c)|a)))) Yes ((((e&f)|a)|(d&(f|e)))|(b&((f|e)|d))) Yes ((c&(f|(a&(d&e))))|(b&((c|(a&(d&e)))|(f&((e|d)|a))))) Yes ((a&(c&(f|d)))|(b&(((d&f)|(c&(f|d)))|(a&((f|d)|c))))) Yes ((((c&d)&e)|(b&(f&((d&e)|(c&(e...
result:
ok 65536 lines, tightest: 33 out of 42 (65536 test cases)
Test #17:
score: 0
Accepted
time: 870ms
memory: 3968kb
input:
65536 7 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 7 00000001000100010001000101110111000100010111011101110111011111110001000101110111011101110111111100010001011101110111011111111111 7 000000010001001100000001001101...
output:
Yes ((((((a&b)&c)&d)&e)&f)&g) Yes (((b&(e&(g|f)))|(d&((b&(g|f))|(e&(((f&g)|b)|(c&(g|f)))))))|(a&(((e&(g|f))|(d&((g|f)|e)))|(b&((((g|f)|e)|d)|c))))) Yes (((((a&c)&e)&f)|(d&(((a&c)&e)|(f&(((e&g)|c)|a)))))|(b&(((f&(e|a))|(d&((f|e)|a)))|(c&(((f|(e&g))|d)|a))))) Yes (((f|(c&(b|g)))&(d|((f&c)&(b|g))))&(a|...
result:
ok 65536 lines, tightest: 68 out of 74 (65536 test cases)
Test #18:
score: 0
Accepted
time: 477ms
memory: 3968kb
input:
16384 8 0000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000100010000000000010001000100010011011100000000000000000000000000010001000000000001000100010001011101110000000000000001000100010011011100010001000101110011011101111111 8 000101010101011100010101011101110...
output:
Yes (((((((c&d)&e)&f)&g)&h)|(b&((((e&f)&g)&h)|(d&((((c&f)&g)&h)|(e&((g&h)|(f&(h|g)))))))))|(a&(((((d&e)&f)&h)|(c&(g&(((e&f)&h)|(d&((f&h)|(e&(h|f))))))))|(b&((((f&g)&h)|(e&((g&h)|(f&(h|g)))))|(d&((((c&g)&h)|(f&(h|g)))|(e&((h|g)|f))))))))) Yes (((((f&h)|(d&(h|f)))|(g&(((h|f)|d)|c)))|(a&((((h|g)|f)|d)|...
result:
ok 16384 lines, tightest: 107 out of 138 (16384 test cases)
Test #19:
score: 0
Accepted
time: 256ms
memory: 4096kb
input:
4096 9 00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000010001011100000...
output:
Yes ((f&(i&((((b&c)&d)&g)|(a&(((c&d)&g)|(b&((d&g)|(c&(g|d)))))))))|(e&((f&((((b&c)&d)&g)|(a&(((c&d)&g)|(b&(((d&g)&h)|(c&((g&h)|d))))))))|(i&(((((b&d)&g)|(f&(((g&h)|d)|b)))|(a&((f|(d&g))|(b&(g|d)))))|(c&(((f|(b&g))|(a&(g|b)))|(d&(((h|g)|b)|a))))))))) Yes ((((((d&h)&i)|(c&(h|(d&i))))|(b&((i&(h|c))|(d&...
result:
ok 4096 lines, tightest: 192 out of 266 (4096 test cases)
Test #20:
score: 0
Accepted
time: 130ms
memory: 4096kb
input:
1024 10 0000000000000000000000000000000100000000000000110000000000000011000000000000000100000000000000110000000000000011000000010000001100000000000000110000000000000011000000000000001100000011000001110000000000000011000000000000001100000011000001110000001100011111000000000000001100000000000000110000...
output:
Yes ((((j|((b|d)&(a|(e|(g|(h|(d&b)))))))&(c|(((b|d)&(j|((d&b)&(a|(e|h)))))&(g|(((a|e)|j)&(h|((j&(d|e))&(b|(e&a)))))))))&(f|(((c|j)&(b|(c&(j|(((h&g)&e)&a)))))&(d|((((b|(h&(e|g)))&(j|((h&g)&e)))&(c|((h&g)&e)))&(a|((j&c)&(b|(g&e)))))))))&(i|((((b|(d|((g|h)&f)))&(c|(((((a|f)|g)|h)&(b|(h&g)))&(d|((h&f)&(...
result:
ok 1024 lines, tightest: 313 out of 522 (1024 test cases)
Test #21:
score: 0
Accepted
time: 63ms
memory: 3840kb
input:
256 11 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((f|h)&(j|((h&f)&(a|(((d|e)|g)|k)))))&(i|((j&(h|(((k&e)&d)&a)))&(f|((((k&g)&e)&d)&a)))))&(b|((((h|((k&e)&d))&(f|((k&e)&d)))&(j|(((k&e)&d)&a)))&(i|((((h&f)&d)&(a|k))&(e|((k&g)&a)))))))&(c|(((((((a|g)|j)|k)&(i|(h&f)))&(b|(((j&i)&h)&f)))&(e|((a|j)&(k|(((j&(g|h))&f)&(a|(i&h)))))))&(d|((((g|j)&(a|...
result:
ok 256 lines, tightest: 547 out of 1034 (256 test cases)
Test #22:
score: 0
Accepted
time: 34ms
memory: 4096kb
input:
64 12 000101011111111101111111111111110001011111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001010111111111011111111111111100010111111111110111111111111111000101111111111101111111111111110001011111111111111111111111111101111111111111111111111111111111011111...
output:
Yes (((((d|(i&((l|b)|(f&(j&(h|g))))))|(e&((((l|j)|i)|(f&(g&h)))|b)))|(a&(((i|e)|b)|(l&((j|(g&h))|f)))))|(k&(((((((l|j)|i)|(g&h))|f)|e)|b)|a)))|(c&(((((k|i)|e)|a)|(l&(j|(f&(g&h)))))|(b&(((l|j)|g)|f))))) Yes ((((((((((a&b)&c)&d)&f)&i)&j)&l)|(g&((a&(b&(c&(i&(j&(l|d))))))|(f&((a&(b&(j&((i&l)|(d&((k&l)|i...
result:
ok 64 lines, tightest: 1089 out of 2058 (64 test cases)
Test #23:
score: 0
Accepted
time: 19ms
memory: 4096kb
input:
16 13 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000011111111111111111111111111111100000000000000000000000000000000000000...
output:
Yes ((((h&(((((((b&c)&d)&g)&k)&l)&m)|(j&((((((c&d)&k)&l)&m)|(g&((((m|l)|k)|d)|c)))|(b&((g|(a&(((d&k)&l)&m)))|(c&(((k&l)&m)|(d&((k&m)|(l&((m|k)|a))))))))))))|(f&(((h&j)|(c&((((((a&d)&h)&k)&l)&m)|(b&((((h&k)&l)&m)|(d&((((j&k)&l)&m)|(h&((l&m)|(k&(m|l)))))))))))|(g&((h&((((d|c)|b)|(m&(k|a)))|(l&((m|k)|a...
result:
ok 16 lines, tightest: 1444 out of 4106 (16 test cases)
Test #24:
score: 0
Accepted
time: 9ms
memory: 4096kb
input:
4 14 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((i&(j&((((((a&c)&e)&h)&k)&m)|(b&(((((a&c)&h)&k)&m)|(e&(((((a&c)&h)&m)&n)|(k&(((a&c)&h)|(m&(((h&n)|c)|(a&(h|(g&n))))))))))))))|(l&((((((b&e)&i)&k)&m)|(c&((b&(e&(h&(k&(m&((g&n)|a))))))|(i&((e&(k&(m&((n|h)|a))))|(b&((k&(m&((n|h)|a)))|(e&((m&((n|h)|a))|(k&(((n|h)|(d&g))|a)))))))))))|(j&(((i&(((e&k...
result:
ok 4 lines, tightest: 1642 out of 8202 (4 test cases)
Test #25:
score: 0
Accepted
time: 8ms
memory: 3968kb
input:
4 14 0000000000000000000000000000000000000000000000000001000100010101000000000000000101010101010101010001010101010101011101110111111100000000000000000000000000000001000000000000000000010101010101010000000100010001010101010101011101010101010101010111111111111111000000000000000000010101010101010000000...
output:
Yes (((e|(((((((((b|c)|d)|h)|i)|j)|k)|l)|n)&(f|((((((((b|c)|d)|h)|j)|k)|l)|n)&(i|((b|(c|(d|(j|(k|(l|(m&h)))))))&(n|((((((d|h)|j)|k)|l)&(c|((((h|j)|k)|l)&(d|((j|k)&(h|(l|((k|m)&j))))))))&(b|(((((d|h)|k)|l)&(c|(((h|k)|l)&(d|(k&(h|l))))))&(j|(((k|(l&(h|m)))&(d|((l&k)&(h|m))))&(c|(((l&k)&(h|m))&d)))))))...
result:
ok 4 lines, tightest: 1123 out of 8202 (4 test cases)
Test #26:
score: 0
Accepted
time: 9ms
memory: 4096kb
input:
4 14 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((((l|(n&(g|(j|(m&(a|(h|k)))))))&(i|(l&(n|((m&j)&g)))))&(b|(((i|n)&(j|(l|(m&(h|k)))))&(g|((l&(n|(m&j)))&(i|((h|m)&(j|((m&h)&(a|k))))))))))&(e|((((((b|g)|j)|m)&(i|(((j|m)&g)&b)))&(l|((((m&j)&h)&g)&b)))&(n|(((((j|m)&i)&g)&b)&(h|(m&j)))))))&(c|(((((l&(b|(g|j)))&(i|((j&g)&b)))&(e|(((i&(h|j))&g)&b...
result:
ok 4 lines, tightest: 2968 out of 8202 (4 test cases)
Test #27:
score: 0
Accepted
time: 8ms
memory: 4096kb
input:
4 14 0000000000000000000000000001001100000000000000110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110000000000110011000000000011001100000000001100110001001100111111001100111111111100110011111111110011001111111111000000000011001100000011001101110000000...
output:
Yes (((((((i&((h&l)|(a&(c&(e&(f&(j&(l|h))))))))|(d&(((h&l)|(c&(e&(f&(j&(l|(a&h)))))))|(i&(((l|h)|(c&(f&j)))|(e&((f|(c&j))|(a&(j|c)))))))))|(n&((((i&(l|(a&((c&f)&j))))|(d&((l|i)|(a&((c&f)&j)))))|(h&((i|d)|(l&(((j|f)|c)|a)))))|(e&((((h&l)|(a&(d&j)))|(f&(d|(i&(j|a)))))|(c&(((f&i)|(a&d))|(j&((i|d)|(a&(f...
result:
ok 4 lines, tightest: 1488 out of 8202 (4 test cases)
Test #28:
score: 0
Accepted
time: 11ms
memory: 4096kb
input:
4 14 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000...
output:
Yes ((((a&(d&(i&(k&(l&((((f&h)&m)&n)|(g&((((e&f)&h)&n)|(m&(((h&n)|f)|(e&(n|h))))))))))))|(c&((d&(((((f&g)&k)&l)&m)|(i&((((f&g)&l)&m)|(k&(((f&g)&m)|(l&((m&(f|(e&(h&n))))|(g&((m|f)|(e&(h&n))))))))))))|(a&((((((g&i)&k)&l)&m)|(f&(((((((e&g)&h)&i)&l)&m)&n)|(k&(((((g&h)&i)&m)&n)|(l&((i&(m&(n|h)))|(g&(((e&...
result:
ok 4 lines, tightest: 1973 out of 8202 (4 test cases)
Test #29:
score: 0
Accepted
time: 3ms
memory: 4096kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes ((((((((((((e|i)|n)&(c|((i|n)&(e|(n&i)))))&(o|(((e|i)&(n|((i&(g|m))&e)))&(c|(((n&i)&(g|m))&e)))))&(h|((((e|i)&(o|((m&i)&e)))&(n|(((o&i)&(g|m))&e)))&(c|((((o&n)&i)&(g|m))&e)))))&(f|(((((e|i)&(o|((i&(g|m))&e)))&(n|(((o&i)&(g|m))&e)))&(h|((((o&n)&m)&i)&e)))&(c|(((((o&n)&i)&h)&(g|m))&e)))))&(d|(((((...
result:
ok 1 lines, tightest: 580 out of 16394 (1 test case)
Test #30:
score: 0
Accepted
time: 5ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((c|(d|(i|(m|((l|(n|(f&(a|(b|k)))))&(g|((l|(n|(k&b)))&(f|((k|(n&l))&(b|(n&l)))))))))))&(o|(((f|(i|(l|(m|(n|(g&b))))))&(d|((f|(l|(m|(n|(g&b)))))&(i|((f|(l|(n|(g&b))))&(m|(((l|n)&(f|(n&l)))&(b|(g|((n&l)&f))))))))))&(c|(((f|(l|(m|(n|(g&b)))))&(i|((f|(l|(n|(g&b))))&(m|(((l|n)&(f|(n&l)))&(b|(g|((n...
result:
ok 1 lines, tightest: 1542 out of 16394 (1 test case)
Test #31:
score: 0
Accepted
time: 5ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...
output:
Yes (((((((((((((a|f)|g)|i)|k)|l)|m)|o)&(n|(((((((a|f)|g)|i)|k)|l)|m)&(o|((f|(g|(i|(m|(l&k)))))&(a|((g|(i|(m|(l&k))))&(f|((i|(m|(l&k)))&(g|((m|(k&(d|l)))&(i|((m&k)&(d|l))))))))))))))&(e|(((a|(f|(g|(n|(o|(l&k))))))&(m|((a|(f|(g|(o|(k&(d|l))))))&(n|((a|(f|(g|(k&(d|l)))))&(o|((((g|k)|l)&(f|((k|l)&g)))&...
result:
ok 1 lines, tightest: 3512 out of 16394 (1 test case)
Test #32:
score: 0
Accepted
time: 5ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000001100000000000000110000001100111111000000000000000000000000000000000000000...
output:
Yes (((((b|(d|(f|(g|(k|(l|(m|(n|(j&a)))))))))&(c|((b|(d|(f|(g|(k|(l|(m&(a|(j|o)))))))))&(n|((b|(d|(f|(g|((l|m)&(a|(j|(m&l))))))))&(k|((((((((a|f)|g)|j)|l)|m)|o)&(d|(((((a|g)|j)|l)|m)&(f|((((a|j)|l)|m)&(g|((l|m)&(j|(l&(m|(o&a)))))))))))&(b|((((((a|g)|j)|l)|m)&(f|((((a|j)|l)|m)&(g|((l|m)&(j|(l&(m|(o&a...
result:
ok 1 lines, tightest: 2821 out of 16394 (1 test case)
Test #33:
score: 0
Accepted
time: 4ms
memory: 4096kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((((((h|(o|(k&(l|(n|(j&g))))))&(f|((h|o)&(k|((o|((n&l)&(g|j)))&(h|((l&(j|n))&(g|(n&j)))))))))&(d|((((k|o)&(h|(o&k)))&(f|((o&h)&(k|(n&(g|j))))))&(l|((((g|j)|o)&(f|k))&(n|((j|(o&h))&(g|(o&h)))))))))&(e|((((h|o)&(d|(o&h)))&(f|(((g|(j|(o&d)))&(l|((o&h)&d)))&(n|((o&(h|(j&g)))&(d|(j&g)))))))&(k|(((...
result:
ok 1 lines, tightest: 1411 out of 16394 (1 test case)
Test #34:
score: 0
Accepted
time: 5ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010100000000000000000000000001010101000000000000000000000000000000000000000...
output:
Yes (((((((((((((b|d)|e)|f)|g)|i)|j)|l)|m)|o)&(a|(((((((((b|d)|f)|g)|i)|j)|l)|m)|o)&(e|((d|(f|(i|(j|(m|((l|o)&(b|(o&l))))))))&(g|((d|(f|(i|(j|(o|((c|l)&(b|(l&c))))))))&(m|((f|(i|(j|(((c|l)|o)&(b|((l|o)&(c|(o&l))))))))&(d|((i|(j|(((o&l)&c)&b)))&(f|((j|(((c|l)|o)&(b|((l|o)&(c|(o&l))))))&(i|((j&(o|(c&b...
result:
ok 1 lines, tightest: 2721 out of 16394 (1 test case)
Test #35:
score: 0
Accepted
time: 1192ms
memory: 3968kb
input:
65536 7 00000000000000010000000100000101000000000001011100000101010111110000000100000001000001110001011100000101001101110011011111111111 7 00000000000000010000000000010111000000000000011100000001011111110000000100000001000000110011011100010101001101110011111111111111 7 000000000000000000000001000100...
output:
Yes (((((d|e)|g)&(b|(f|(e&(d|g)))))&(a|(((f|(g&e))&(d|(g&e)))&(b|((f&e)&d)))))&(c|((((b|e)&(a|g))&(d|((g&e)&b)))&(f|((((g&e)&d)&b)&a))))) Yes (((((a|e)|f)&(c|(((a|f)|g)&(e|(g&f)))))&(d|(((c|f)&(a|e))&(g|(((f&e)&c)&a)))))&(b|((((d|g)&(a|e))&(f|((e&d)&a)))&(c|(((f&e)&d)&(a|g)))))) Yes (((((a|e)|g)&(b|...
result:
ok 65536 lines, tightest: 47 out of 74 (65536 test cases)
Test #36:
score: 0
Accepted
time: 215ms
memory: 3840kb
input:
1024 10 0000000000000000000000000000000000000000000000000000000000000011000000000000000000000001000001110000000000000111000101010111011100000000000000000000000000000111000000010001011100010011000101110000000100000001000001110001011100000101011111110101111111111111000000000000000100000000000100010000...
output:
Yes ((((((((a|d)|e)|i)|j)&(b|(g|(((a|i)|j)&(d|((a|i)&(j|((i&e)&a))))))))&(c|((e|(((b|d)|j)&(a|(g|((j&d)&b)))))&(i|((((d|e)|j)&(a|((d|j)&(b|((e|j)&d)))))&(g|(((d|e)&(a|(j&e)))&(b|(((j&e)&d)&a)))))))))&(f|((((((d|g)|i)|j)&(b|(((d|g)|i)&(a|((i|j)&(d|(j&i)))))))&(c|((((b|g)|i)&(a|(d|(g&b))))&(j|(((b|g)&...
result:
ok 1024 lines, tightest: 255 out of 522 (1024 test cases)
Test #37:
score: 0
Accepted
time: 58ms
memory: 4096kb
input:
64 12 000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000101110000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000010000000100010101000101110111111100000000000000000000000000000001000000...
output:
Yes ((((((((((c&d)&e)&f)&h)&l)|(k&((c&(d&(f&(h&(l|e)))))|(a&((((c&d)&f)&h)|(e&(l&((d&(h|f))|(c&(h|f))))))))))|(i&((((((c&d)&f)&h)&k)|(a&((((c&d)&f)&h)|(k&((f&(h&(l|d)))|(c&((h&l)|(d&(l|f)))))))))|(e&(((((c&d)&k)&l)|(a&(((c&d)&l)|(k&((d&f)|(l&((f|d)|c)))))))|(h&((((a&d)&k)|(c&((a&l)|(d&(l|k)))))|(f&(...
result:
ok 64 lines, tightest: 902 out of 2058 (64 test cases)
Test #38:
score: 0
Accepted
time: 52ms
memory: 4096kb
input:
64 12 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...
output:
Yes ((((((((((d|e)|f)|j)|k)&(b|((((d|e)|j)|k)&(c|(f|((j|(k&e))&(d|(k&e))))))))&(i|(((((b|c)|d)|k)&(j|(((b|d)|e)&(k|((b|e)&(c|((e&d)&b)))))))&(f|((((b|e)|k)&(c|((j|k)&(e|(j&b)))))&(d|(((e|j)&(c|(k&j)))&(b|((k&j)&e)))))))))&(g|((((((e|i)|j)|k)&(d|(((i|j)|k)&(e|((i|k)&(f|(k&j)))))))&(c|((((e|i)|j)&(f|(...
result:
ok 64 lines, tightest: 735 out of 2058 (64 test cases)
Test #39:
score: 0
Accepted
time: 39ms
memory: 3968kb
input:
64 12 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000...
output:
Yes ((((((((((g|i)|j)|k)&(c|(((g|i)|j)&(a|((i|k)&(g|j))))))&(f|((((g|j)|k)&(a|((g|k)&(c|j))))&(i|(((a|k)&(j|(k&c)))&(g|((j&(c|k))&a)))))))&(l|(((((a|i)|j)&(f|(k|(j&i))))&(g|(((i|k)&(f|(j&i)))&(a|((k&j)&i)))))&(c|(((k|(g&(a|j)))&(i|((k&g)&a)))&(f|(((k&j)&g)&a)))))))&(b|((((g|((c|l)&(a|i)))&(k|(((a|l)...
result:
ok 64 lines, tightest: 453 out of 2058 (64 test cases)
Test #40:
score: 0
Accepted
time: 17ms
memory: 3968kb
input:
4 14 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010111000000000000000000000000000000000000000...
output:
Yes ((((((((((((a|e)|g)|h)|k)|l)|n)&(f|((((((a|e)|h)|k)|l)|n)&(g|((((((a|e)|j)|k)|l)|n)&(h|((((a|e)|l)|n)&(j|(((e|l)|n)&(k|((a|e)&(l|((n&e)&a)))))))))))))&(c|(((((((e|f)|g)|h)|l)|n)&(a|(((((f|g)|k)|l)|n)&(e|((((f|g)|l)|n)&(k|(((f|g)|l)&(h|((g|(n&l))&(f|((n&l)&g)))))))))))&(j|((((((a|e)|f)|g)|l)&(h|(...
result:
ok 4 lines, tightest: 3234 out of 8202 (4 test cases)
Test #41:
score: 0
Accepted
time: 14ms
memory: 4224kb
input:
4 14 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000...
output:
Yes ((((((((((((f|g)|i)|k)|m)|n)&(c|(((((e|i)|k)|m)|n)&(f|((((e|k)|m)|n)&(i|(((e|m)|n)&(k|((m|n)&(g|(n&e)))))))))))&(h|((((((e|f)|g)|k)|n)&(m|((f|(g|(n|(k&c))))&(e|((g|(n|(k&f)))&(c|((g|k)&(f|(n&k)))))))))&(i|(((((c|f)|m)|n)&(g|(((c|e)|f)&(n|((m|(f&e))&(c|(f&e)))))))&(k|((((f|m)|n)&(c|((g|n)&(m|(n&f...
result:
ok 4 lines, tightest: 2686 out of 8202 (4 test cases)
Test #42:
score: 0
Accepted
time: 8ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000001000000000000000000000000000000000000000...
output:
Yes (((((((((((((e&f)&g)&j)&k)&l)&n)|(c&(((((((f&g)&j)&k)&l)&n)&o)|(e&(((((g&j)&k)&l)&n)|(f&((k&(n&(o&(l|g))))|(j&((l&(n&(o|g)))|(k&((n&(o|l))|(g&(o|l)))))))))))))|(a&(((((((f&g)&j)&k)&n)&o)|(e&(((((c&g)&j)&n)&o)|(f&((((c&g)&j)&n)|(o&((k&(n&(j|c)))|(g&((j&(n|k))|(c&((n|k)|j)))))))))))|(l&((((((f&g)&...
result:
ok 1 lines, tightest: 5836 out of 16394 (1 test case)
Test #43:
score: 0
Accepted
time: 8ms
memory: 3968kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((((((((((a|c)|e)|i)|l)|n)|o)&(k|((((((a|c)|e)|l)|n)|o)&(j|(((((a|c)|e)|n)|o)&(i|((((c|e)|l)|n)&(o|((e|(l|(n&c)))&(a|((l|n)&(c|((n&l)&e)))))))))))))&(g|(((((((a|e)|j)|l)|n)|o)&(c|(((((i|j)|l)|n)|o)&(e|((((i|j)|l)|o)&(a|((j|(o|(n&i)))&(l|((i|o)&(n|((o&j)&i)))))))))))&(k|((((((e|i)|l)|n)|o)&(a|...
result:
ok 1 lines, tightest: 5847 out of 16394 (1 test case)
Test #44:
score: 0
Accepted
time: 6ms
memory: 4224kb
input:
1 15 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
Yes (((((((((((((b|g)|h)|j)|n)|o)&(d|(((((g|h)|m)|n)|o)&(j|((((h|m)|n)|o)&(b|(((h|n)|o)&(g|(m|(o&n))))))))))&(k|((((((d|j)|m)|n)|o)&(g|((((b|j)|m)|o)&(n|((m|(o|(d&b)))&(j|((o|(m&d))&(b|((o&m)&d)))))))))&(h|(((((d|g)|m)|n)&(j|((m|(n|(o&d)))&(g|((m|n)&(o|((n&m)&d)))))))&(b|((((m|n)|o)&(g|((n|o)&(j|m))...
result:
ok 1 lines, tightest: 4238 out of 16394 (1 test case)
Extra Test:
score: 0
Extra Test Passed