QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#120194 | #6344. The Best Problem of 2021 | hos_lyric | AC ✓ | 407ms | 4484kb | C++14 | 13.8kb | 2023-07-06 14:53:55 | 2023-07-06 14:53:58 |
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 <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; }
////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0U) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModInt inv() const {
unsigned a = M, b = x; int y = 0, z = 1;
for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
assert(a == 1U); return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
constexpr unsigned MO = 998244353U;
constexpr unsigned MO2 = 2U * MO;
constexpr int FFT_MAX = 23;
using Mint = ModInt<MO>;
constexpr Mint FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 911660635U, 372528824U, 929031873U, 452798380U, 922799308U, 781712469U, 476477967U, 166035806U, 258648936U, 584193783U, 63912897U, 350007156U, 666702199U, 968855178U, 629671588U, 24514907U, 996173970U, 363395222U, 565042129U, 733596141U, 267099868U, 15311432U};
constexpr Mint INV_FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 86583718U, 509520358U, 337190230U, 87557064U, 609441965U, 135236158U, 304459705U, 685443576U, 381598368U, 335559352U, 129292727U, 358024708U, 814576206U, 708402881U, 283043518U, 3707709U, 121392023U, 704923114U, 950391366U, 428961804U, 382752275U, 469870224U};
constexpr Mint FFT_RATIOS[FFT_MAX] = {911660635U, 509520358U, 369330050U, 332049552U, 983190778U, 123842337U, 238493703U, 975955924U, 603855026U, 856644456U, 131300601U, 842657263U, 730768835U, 942482514U, 806263778U, 151565301U, 510815449U, 503497456U, 743006876U, 741047443U, 56250497U, 867605899U};
constexpr Mint INV_FFT_RATIOS[FFT_MAX] = {86583718U, 372528824U, 373294451U, 645684063U, 112220581U, 692852209U, 155456985U, 797128860U, 90816748U, 860285882U, 927414960U, 354738543U, 109331171U, 293255632U, 535113200U, 308540755U, 121186627U, 608385704U, 438932459U, 359477183U, 824071951U, 103369235U};
// as[rev(i)] <- \sum_j \zeta^(ij) as[j]
void fft(Mint *as, int n) {
assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
int m = n;
if (m >>= 1) {
for (int i = 0; i < m; ++i) {
const unsigned x = as[i + m].x; // < MO
as[i + m].x = as[i].x + MO - x; // < 2 MO
as[i].x += x; // < 2 MO
}
}
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i + m].x = as[i].x + MO - x; // < 3 MO
as[i].x += x; // < 3 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
for (; m; ) {
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i + m].x = as[i].x + MO - x; // < 4 MO
as[i].x += x; // < 4 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
if (m >>= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned x = (prod * as[i + m]).x; // < MO
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i + m].x = as[i].x + MO - x; // < 3 MO
as[i].x += x; // < 3 MO
}
prod *= FFT_RATIOS[__builtin_ctz(++h)];
}
}
}
for (int i = 0; i < n; ++i) {
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i].x = (as[i].x >= MO) ? (as[i].x - MO) : as[i].x; // < MO
}
}
// as[i] <- (1/n) \sum_j \zeta^(-ij) as[rev(j)]
void invFft(Mint *as, int n) {
assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
int m = 1;
if (m < n >> 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + m; ++i) {
const unsigned long long y = as[i].x + MO - as[i + m].x; // < 2 MO
as[i].x += as[i + m].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
}
m <<= 1;
}
for (; m < n >> 1; m <<= 1) {
Mint prod = 1U;
for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
for (int i = i0; i < i0 + (m >> 1); ++i) {
const unsigned long long y = as[i].x + MO2 - as[i + m].x; // < 4 MO
as[i].x += as[i + m].x; // < 4 MO
as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
for (int i = i0 + (m >> 1); i < i0 + m; ++i) {
const unsigned long long y = as[i].x + MO - as[i + m].x; // < 2 MO
as[i].x += as[i + m].x; // < 2 MO
as[i + m].x = (prod.x * y) % MO; // < MO
}
prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
}
}
if (m < n) {
for (int i = 0; i < m; ++i) {
const unsigned y = as[i].x + MO2 - as[i + m].x; // < 4 MO
as[i].x += as[i + m].x; // < 4 MO
as[i + m].x = y; // < 4 MO
}
}
const Mint invN = Mint(n).inv();
for (int i = 0; i < n; ++i) {
as[i] *= invN;
}
}
void fft(vector<Mint> &as) {
fft(as.data(), as.size());
}
void invFft(vector<Mint> &as) {
invFft(as.data(), as.size());
}
vector<Mint> convolve(vector<Mint> as, vector<Mint> bs) {
if (as.empty() || bs.empty()) return {};
const int len = as.size() + bs.size() - 1;
int n = 1;
for (; n < len; n <<= 1) {}
as.resize(n); fft(as);
bs.resize(n); fft(bs);
for (int i = 0; i < n; ++i) as[i] *= bs[i];
invFft(as);
as.resize(len);
return as;
}
vector<Mint> square(vector<Mint> as) {
if (as.empty()) return {};
const int len = as.size() + as.size() - 1;
int n = 1;
for (; n < len; n <<= 1) {}
as.resize(n); fft(as);
for (int i = 0; i < n; ++i) as[i] *= as[i];
invFft(as);
as.resize(len);
return as;
}
////////////////////////////////////////////////////////////////////////////////
constexpr int MAX = 2010;
using Vec = bitset<MAX>;
Mint two[MAX], two2[MAX], qFac[MAX], qInvFac[MAX];
void qPrepare() {
two[0] = two2[0] = qFac[0] = 1;
for (int i = 1; i < MAX; ++i) {
two[i] = two[i - 1] * 2;
two2[i] = two2[i - 1] * two[i - 1];
qFac[i] = qFac[i - 1] * (two[i] - 1);
}
qInvFac[MAX - 1] = qFac[MAX - 1].inv();
for (int i = MAX; --i >= 1; ) {
qInvFac[i - 1] = (two[i] - 1) * qInvFac[i];
}
}
Mint qBinom(int n, int k) {
assert(0 <= k); assert(k <= n);
return qFac[n] * qInvFac[k] * qInvFac[n - k];
}
int N, M;
Vec B[MAX], X;
char buf[MAX];
void readVec(Vec &vec) {
scanf("%s", buf);
vec.reset();
for (int j = 0; j < M; ++j) {
vec[j] = buf[M - 1 - j] - '0';
}
}
int main() {
qPrepare();
for (; ~scanf("%d%d", &N, &M); ) {
for (int i = 0; i < N; ++i) {
readVec(B[i]);
}
readVec(X);
int r = 0;
vector<int> js;
for (int j = M; --j >= 0; ) {
for (int i = r; i < N; ++i) if (B[i][j]) {
swap(B[r], B[i]);
break;
}
if (r < N && B[r][j]) {
for (int i = 0; i < N; ++i) if (r != i && B[i][j]) {
B[i] ^= B[r];
}
++r;
js.push_back(j);
}
}
// cerr<<"r = "<<r<<", js = "<<js<<endl;
// for(int i=0;i<N;++i){for(int j=M;--j>=0;)cerr<<B[i][j];cerr<<endl;}
Mint ans = 0;
if (r == N) {
/*
\oplus[i] B[N-1-i] c[i] <= X
<=> \sum[i] 2^i c[i] < Y
*/
vector<int> ys(N + 1, 0);
{
Vec x;
for (int i = N; --i >= 0; ) {
x ^= B[N - 1 - i];
bool ok = true;
for (int j = M; --j >= 0; ) {
if (!x[j] && X[j]) { ok = true; break; }
if (x[j] && !X[j]) { ok = false; break; }
}
if (ok) {
++ys[i];
} else {
x ^= B[N - 1 - i];
}
}
}
++ys[0];
for (int j = 0; j < N; ++j) {
ys[j + 1] += ys[j] / 2;
ys[j] %= 2;
}
int n = -1;
for (int j = 0; j <= N; ++j) if (ys[j]) {
n = j;
}
// cerr<<"n = "<<n<<", ys = "<<ys<<endl;
if (N <= n + 1) {
/*
Y = 10110
1010*
100**
0****
*/
// PIE
vector<Mint> crt(n + 2, 0);
crt[0] = 1;
for (int i = 0; i <= n; ++i) if (ys[i]) {
vector<Mint> nxt(n + 2, 0);
// add nothing
if (i < n) {
for (int k = 0; k <= n + 1; ++k) {
nxt[k] += crt[k];
}
}
/*
choose any (or i == n)
low bits: k-dim -> l-dim
count pairs (subspace, subset of vectors)
nxt[l + ?] += \sum[k<=m<=l] coef(l, m) qbinom(i-k, m-k) way(m) crt[k + ?]
subspace inversion:
g[l] = \sum[0<=m<=l] qbinom(i-m, l-m) f[m]
f[l] = \sum[0<=m<=l] (-1)^(l-m) 2^binom(l-m,2) qbinom(i-m, l-m) g[m]
- i < n
take one of 2^i vectors
choose from (2^l-1) vectors
remove multiple counting
way(m) = 2^i \sum[a] (1/(a+1)) binom(2^m-1, a)
= 2^i (2^(2^m) - 1) / 2^m
- i == n
choose from (2^m-1) vectors
way(m) = 2^(2^m-1)
*/
// from zero space or from non-zero space
for (int phase = 0; phase < 2; ++phase) {
vector<Mint> fs(i + 1, 0), gs(i + 1, 0);
if (phase == 0) {
fs[0] += crt[0] * qFac[i - 0];
} else {
for (int k = 0; k <= i; ++k) {
fs[k] = crt[k + 1] * qFac[i - k];
}
}
for (int k = 0; k <= i; ++k) {
gs[k] = qInvFac[k];
}
fs = convolve(fs, gs);
fs.resize(i + 1);
Mint t = 1;
for (int k = 0; k <= i; ++k) {
fs[k] *= ((i < n) ? (two[i - k] * (t * 2 - 1)) : t);
t = t * t * 2;
gs[k] = ((k&1)?-1:+1) * two2[k] * qInvFac[k];
}
fs = convolve(fs, gs);
fs.resize(i + 1);
for (int k = 0; k <= i; ++k) {
nxt[k + phase + ((i < n) ? 1 : 0)] += fs[k] * qInvFac[i - k];
}
// cerr<<"i = "<<i<<", nxt = "<<nxt<<endl;
}
swap(crt, nxt);
}
// Mint all=0;for(int k=0;k<=N;++k)all+=crt[k];cerr<<"all = "<<all<<endl;
ans += crt[N];
}
}
printf("%u\n", ans.x);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3688kb
input:
4 4 0001 0010 0100 1000 1101
output:
7364
result:
ok 1 number(s): "7364"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
3 2 00 00 00 11
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
2 3 110 101 101
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
3 10 1111100110 0011110100 0101100001 1110000001
output:
38
result:
ok 1 number(s): "38"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
7 13 1000101001000 1000000010000 1010101011111 1001100100111 1111111101100 0101010101110 1101100010100 1000010011001
output:
744450298
result:
ok 1 number(s): "744450298"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3744kb
input:
100 100 1111010111010001011111110010101001001101000000000000011000001100101000100011100011000000110000001010 1001001110111010100100010111100010111110101100101000010111001011111010111100111000000011101010100111 000011010111000100110100010010011101001111100110111000100101010001101100101011000111101101...
output:
19562313
result:
ok 1 number(s): "19562313"
Test #7:
score: 0
Accepted
time: 19ms
memory: 3972kb
input:
400 500 1011011011010010111110101001010011000100001111000111111111001111100010101011110011010010011100100100111111000111001110111100101010000000100100011011011001011100100000000100001100001010100010111000110011000100101001010110110100110101000011011011011100111110010100101000011001100000001100001000...
output:
681985268
result:
ok 1 number(s): "681985268"
Test #8:
score: 0
Accepted
time: 96ms
memory: 4164kb
input:
999 1997 011101110101100100111101100000000100001110010001010100011010111010101101011100001000010001110100110111101101010111010011101111011001011100110110101011111011000111101011011000010101100101001110000111010101111100000100100101110000111001010101110110000001111111100110110011110100101000011100011...
output:
435150194
result:
ok 1 number(s): "435150194"
Test #9:
score: 0
Accepted
time: 350ms
memory: 4448kb
input:
1901 2000 10000111000111010000000000100110001100110010011001101110001011000001011000010111101110111001111000010110110100010100010101011111011101100111010101010001010010111010001011000001011010100011000101101010001110111100000101110110011001101111101111000100001010011101011110001100110001100000111110...
output:
9254020
result:
ok 1 number(s): "9254020"
Test #10:
score: 0
Accepted
time: 372ms
memory: 4424kb
input:
1984 2000 11111101001011101001011011010011000001100000101000001001111000100010011011000110110110100000001100000000001111101001111010111110000000010000000111111001010111101101110000111110010111001011011111010010110001011100110101000110000100010100100101010111101100000011110010010100101011101001110110...
output:
870006511
result:
ok 1 number(s): "870006511"
Test #11:
score: 0
Accepted
time: 48ms
memory: 4264kb
input:
2000 2000 00010001100000101100000110010101010101110010001000000100010010110010001100110000001110100111010110100110101010101111011100001110100011001000010001000011100111010100110101000111010010010111001001101100100000101001111111001111101001000101001011101001010010010101011110111001101101101001001000...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
11 11 10000000000 01000000000 00100000000 00010000000 00001000000 00000100000 00000010000 00000001000 00000000100 00000000010 00000000001 10111110000
output:
312889397
result:
ok 1 number(s): "312889397"
Test #13:
score: 0
Accepted
time: 2ms
memory: 3792kb
input:
100 100 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
554554135
result:
ok 1 number(s): "554554135"
Test #14:
score: 0
Accepted
time: 79ms
memory: 4176kb
input:
1000 1000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
944188930
result:
ok 1 number(s): "944188930"
Test #15:
score: 0
Accepted
time: 352ms
memory: 4484kb
input:
1999 1999 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
753324940
result:
ok 1 number(s): "753324940"
Test #16:
score: 0
Accepted
time: 369ms
memory: 4352kb
input:
2000 2000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
489943678
result:
ok 1 number(s): "489943678"
Test #17:
score: 0
Accepted
time: 363ms
memory: 4484kb
input:
2000 2000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
458543942
result:
ok 1 number(s): "458543942"
Test #18:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
37 100 0000000000100000010101011000010111111000000000000000000000000000000000001110100110101000000010110000 0111100011011110101011110100101001011000000000110010001010110100000000010000100000111011000000100000 0001110011110000001100011000010011001000000000000000000000000000000000000000000000000000010...
output:
807297668
result:
ok 1 number(s): "807297668"
Test #19:
score: 0
Accepted
time: 3ms
memory: 3724kb
input:
71 93 100010100111111001011100000000011001101101010001011001110001101110010000001000001000000000011 110100111110010001000110000101111010111111000111011010100001010000010110011000000100000000000 110010010110000000010001010100000011000100000010011100100000100100101100010100001100000010000 000101010010...
output:
50935767
result:
ok 1 number(s): "50935767"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
101 114 010101111101011101100001000100001001000100011100111111110010001111101001100100000110100101010110000000000000001000 101010000011100100000001100000110000111001111011000010010101001011110110100101011101111111111110111010000000000000 11011100100101010100101100000101100000010100000010010110101010...
output:
0
result:
ok 1 number(s): "0"
Test #21:
score: 0
Accepted
time: 2ms
memory: 3744kb
input:
17 2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010101111100001010111000001111010110101100011000011011111110001011001011010111110111110000110011101111011010110101011010100110001111110110110101000101110100110011001000010000001010...
output:
526829746
result:
ok 1 number(s): "526829746"
Test #22:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
30 1999 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
708057099
result:
ok 1 number(s): "708057099"
Test #23:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
54 2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 7ms
memory: 3988kb
input:
791 1999 101011000010100101111110010001001001000000000001111100001000101100011110001010010011111110111010100011111010001110000001100010000011001110110011011011110110101100010010110111011000101111010100101110110010100011100100011001100000000001000001010100000000100111011000101111100100001000011010001...
output:
64451741
result:
ok 1 number(s): "64451741"
Test #25:
score: 0
Accepted
time: 89ms
memory: 4116kb
input:
944 2000 110101011100010000001010011011000001001001101001001011101110100000001000000010101011111001101010110100011101110100110010110000011100011111000001011110100111011101110010100100110111001110110001101010011101100010100100000010110101000101111000101110011000111000111111101110001101101110111110001...
output:
996119909
result:
ok 1 number(s): "996119909"
Test #26:
score: 0
Accepted
time: 23ms
memory: 4100kb
input:
1102 1999 10001010010010110101001000110000010000000110101001010111100100000110001111111100111001000111000111110100101101010110111110110001111011110101111001101100101110001011100001100000000000111111111000111010000111100010011010100001001011110111011110100001000100111000100001000010111001111011110001...
output:
855516290
result:
ok 1 number(s): "855516290"
Test #27:
score: 0
Accepted
time: 54ms
memory: 4236kb
input:
1931 2000 01101111100011101110100101000110011110000111000001010001011111010110011001111110110010111000100010111101001100001100001100010101000011001000110001011101111001000111101011011100011110010100001111111000101111000110000000000010110101110001000001011111001000001001100110101100100010101010010000...
output:
0
result:
ok 1 number(s): "0"
Test #28:
score: 0
Accepted
time: 375ms
memory: 4432kb
input:
1944 1999 10000110101111110110111101101000111110100010000011101101000011101100110000110001110000100000100101011111100100111000100110011111110111011100100000111000101110011100101011000011101101010001111110110100101101001011010011111111011111001101010000101011110010010110110101110000000111010100111101...
output:
52786402
result:
ok 1 number(s): "52786402"
Test #29:
score: 0
Accepted
time: 53ms
memory: 4200kb
input:
1977 2000 10011110110110110011001100011011011110111110001001101000101110100111011100011101001100100101110101010001100011001110111011101101100010000010100010001011011011001111011010111011100010101010101111101100001000111011100010111000000101111110100001111011111111111111110101101001101001111100011100...
output:
0
result:
ok 1 number(s): "0"
Test #30:
score: 0
Accepted
time: 43ms
memory: 4332kb
input:
2000 2000 01110010111000111001110000110111011110010010111001000001100101101011000001010111111010001100110000101001001000000000011001101101010001010011010000111011111101001110110010110101110101100100000011110100100010110001110010101001000110100100001001001111000111001011110110101100101011011011101010...
output:
3964016
result:
ok 1 number(s): "3964016"
Test #31:
score: 0
Accepted
time: 48ms
memory: 4200kb
input:
1994 1999 00001100011011001011110111100001111001010110101100010010111001011000100111011110000010100111100001101101100000101111101111001001011001000111111011010110001111001100110000100001101001011001001011100101000101010000110001101000100110110010011010000001000110001010101101111100010110001010101000...
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 62ms
memory: 4152kb
input:
1997 2000 01111000101001101011000100101111110000011100111100101100111100110000100101010001011110111100101000001001000110100110111101011101010100010110101011010010000100000110011111100000100011000110001110000111011010110001001001000001110101011011011000101111010000010101101111110100110011110100101000...
output:
0
result:
ok 1 number(s): "0"
Test #33:
score: 0
Accepted
time: 401ms
memory: 4420kb
input:
2000 2000 00110111110110101110100001011000000101001011010011111001100000001001101100111111100001100010111101001110101001101010111011111000000110101101101110100111110101111110010000001001010100111101011010100000010001110100100010010100101010100110011101011110111100111110101110111010010111010010100010...
output:
385756366
result:
ok 1 number(s): "385756366"
Test #34:
score: 0
Accepted
time: 407ms
memory: 4448kb
input:
1988 1999 10101010110010100000101100110010001110101111010010001011010100100010101111001010100110100101100100111101000001000110001011110000001110000000110000001111000100101100000000111011011011110111101000001110111111000110011011111011010000010011100010010110111010000011010001011100010001011001100000...
output:
534584509
result:
ok 1 number(s): "534584509"
Test #35:
score: 0
Accepted
time: 66ms
memory: 4212kb
input:
2000 2000 00100000011001010111100000100001011101010011001010100100100001100000000100010110000110010111010000100110010000010001110100010100111001000110111001011101101110111000000111000000111101011010000110010011110011010000010101000111100100100001101001100010101101011111001010001011101001100001011010...
output:
0
result:
ok 1 number(s): "0"
Test #36:
score: 0
Accepted
time: 58ms
memory: 4200kb
input:
1995 2000 10010000010101100111011100110001101101000100010011110100110111110000000111010000111101011000101000111000010010010111000010101110110100011100111010110110110100111101010100000110001010010001011001000100011110101100110111010110101010100100011010101100001010111111000100101110001101000000010010...
output:
0
result:
ok 1 number(s): "0"
Test #37:
score: 0
Accepted
time: 397ms
memory: 4432kb
input:
1999 1999 11011110110011001100010110011001000101010101001001010101111111000111100000001101101101101010001111010000011101100110100111011010011011001101010011001100011111010100001000100100100111010111001000000010101100100010001111100100101110100010010010101000000110101011101001110010111111011101000101...
output:
678369480
result:
ok 1 number(s): "678369480"
Test #38:
score: 0
Accepted
time: 48ms
memory: 4156kb
input:
1999 2000 11000110010001011100111010011110110100101101000010111101001010100000100100011101011000110000101011011111110101001101111010010010010001011110101001010000010100110110100110011110011101001100000001110100001100110111011001110000110110000101110011110010110100110011010111011001011010111000000110...
output:
0
result:
ok 1 number(s): "0"