QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#164364 | #1245. Three balls | ucup-team1600# | AC ✓ | 1111ms | 199308kb | C++20 | 10.5kb | 2023-09-04 22:05:56 | 2023-09-04 22:05:57 |
Judging History
answer
//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#ifdef LOCAL
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>
#else
#include <bits/stdc++.h>
#endif
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
template<typename T>
inline bool umin(T &a, T b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template<typename T>
inline bool umax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL
const int max_n = -1, inf = 1000111222;
const int MOD = 1e9 + 7;
struct mint {
int val;
mint () : val(0) {}
mint (int x) {
if (-MOD <= x && x < MOD) {
val = x;
}
else {
val = x % MOD;
}
if (val < 0) val += MOD;
}
mint (ll x) {
if (-MOD <= x && x < MOD) {
val = x;
}
else {
val = x % MOD;
}
if (val < 0) val += MOD;
}
mint (const mint& x) : val(x.val) {}
constexpr mint& operator = (const mint& x) {
val = x.val;
return *this;
}
inline mint& operator += (const mint &x) {
val += x.val;
if (val >= MOD) {
val -= MOD;
}
return *this;
}
inline mint& operator -= (const mint &x) {
val -= x.val;
if (val < 0) {
val += MOD;
}
return *this;
}
inline mint operator - () const {
mint tmp(*this);
if (tmp.val) tmp.val = MOD - tmp.val;
return tmp;
}
inline mint operator + (const mint &x) const {
return mint(*this) += x;
}
inline mint operator - (const mint &x) const {
return mint(*this) -= x;
}
inline mint& operator *= (const mint &x) {
val = ((ll)val * x.val) % MOD;
return *this;
}
inline mint operator * (const mint &x) const {
return mint(*this) *= x;
}
inline mint binpow (int n) const {
mint res = 1, tmp = *this;
for (; n; n >>= 1) {
if (n & 1) {
res *= tmp;
}
tmp *= tmp;
}
return res;
}
inline mint inverse () const {
return binpow(MOD - 2);
}
inline mint& operator /= (const mint &x) {
return *this *= x.inverse();
}
inline mint operator / (const mint &x) {
return mint(*this) *= x.inverse();
}
friend ostream& operator << (ostream &os, const mint &x) {
os << x.val;
return os;
}
friend istream& operator >> (istream &is, mint &x) {
is >> x.val;
return is;
}
inline bool operator == (const mint &x) const {
return val == x.val;
}
inline bool operator != (const mint &x) const {
return val != x.val;
}
inline bool operator < (const mint &x) const {
return val < x.val;
}
inline bool operator > (const mint &x) const {
return val > x.val;
}
friend string to_string (const mint &x) {
return to_string(x.val);
}
};
vector <mint> f = {1}, fi = {1};
inline mint fact (int n) {
f.reserve(n + 1);
while (len(f) <= n) {
f.emplace_back(f.back() * len(f));
}
return f[n];
}
inline mint inv_fact (int n) { /// think
if (len(fi) <= n) {
fi.resize(n + 1, 0);
mint val = mint(1) / fact(n);
for (int i = n; fi[i] == 0; i--) {
fi[i] = val;
val *= i;
}
}
return fi[n];
}
inline mint A (int n, int k) {
if (k < 0 || k > n) return 0;
return fact(n) * inv_fact(n - k);
}
inline mint C (int n, int k) {
if (k < 0 || k > n) return 0;
return A(n, k) * inv_fact(k);
}
const int debug = 0;
mt19937 rng(228);
template<typename T = int>
inline T randll(T l = INT_MIN, T r = INT_MAX) {
return uniform_int_distribution<T>(l, r)(rng);
}
inline ld randld(ld l = INT_MIN, ld r = INT_MAX) {
return uniform_real_distribution<ld>(l, r)(rng);
}
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
m1:
int n;
if (!debug) {
cin >> n;
}
else {
n = randll(1, 3);
}
inv_fact(n + 5);
vector <pair<int, string> > a(3);
mint ans = 0;
for (auto &i : a) {
if (!debug) {
cin >> i.first >> i.second;
}
else {
i.first = randll(0, n);
for (int j = 0; j < n; j++) {
i.second += "01"[randll(0, 1)];
}
}
for (int j = 0; j <= i.first; j++) {
ans += C(n, j);
}
}
int cc[8] = {};
for (int i = 0; i < n; i++) {
int mask = (a[0].second[i] - '0') | ((a[1].second[i] - '0') << 1) | ((a[2].second[i] - '0') << 2);
int cnt = __builtin_popcount(mask);
if (cnt > 1) {
mask ^= 7;
}
++cc[mask];
}
int c[4] = {cc[0], cc[1], cc[2], cc[4]};
int r[4] = {0, a[0].first, a[1].first, a[2].first};
vector <vector <mint> > pref1(c[3] + 1, vector <mint> (c[0] + 1));
vector <vector <mint> > pref2(c[3] + 1, vector <mint> (c[0] + 1));
vector <mint> pref(c[3] + 1);
for (int i = 0; i <= c[3]; i++) {
pref[i] = C(c[3], i);
if (i) {
pref[i] += pref[i - 1];
}
}
for (int R = c[0]; R >= 0; R--) {
for (int rr = 0; rr <= c[3]; rr++) {
pref1[rr][R] = C(c[0], R) * pref[rr];
if (rr && R + 1 <= c[0]) {
pref1[rr][R] += pref1[rr - 1][R + 1];
}
}
}
for (int R = c[0]; R >= 0; R--) {
for (int rr = 0; rr <= c[3]; rr++) {
pref2[rr][R] = C(c[0], R) * pref[rr];
if (rr + 1 <= c[3] && R + 1 <= c[0]) {
pref2[rr][R] += pref2[rr + 1][R + 1];
}
}
}
vector <mint> PREF(c[0] + 1);
for (int i = 0; i <= c[0]; i++) {
PREF[i] = C(c[0], i);
if (i) {
PREF[i] += PREF[i - 1];
}
}
auto get_pref = [&] (int l, int r) -> mint {
umin(r, c[0]);
umax(l, 0);
if (l > r) {
return 0;
}
return PREF[r] - (l ? PREF[l - 1] : mint(0));
};
auto get_sum1 = [&] (int r, int R) -> mint {
mint res = 0;
if (r > c[3]) {
int diff = r - c[3];
r -= diff;
res = pref.back() * get_pref(R, R + diff - 1);
R += diff;
}
if (r < 0 || R > c[0]) {
return res;
}
assert(R >= 0);
return pref1[r][R] + res;
};
auto get_sum2 = [&] (int l, int R) -> mint {
if (l < 0) {
int diff = -l;
l += diff;
R += diff;
}
if (l > c[3] || R > c[0]) {
return 0;
}
assert(R >= 0);
return pref2[l][R];
};
LOG(ans, "start");
for (int x = 0; x <= c[1]; x++) {
for (int y = 0; y <= c[2]; y++) {
int L = max(x - y + c[2] + c[3] - r[1], y - x + c[1] + c[3] - r[2]);
int R = r[3] - c[1] - c[2] + x + y;
if (L <= R && R >= 0) {
mint coeff = C(c[1], x) * C(c[2], y);
int cnt = min({(R - L + 2) / 2, c[3] - L + 1, R + 1});
if (cnt < 0) {
continue;
}
LOG(coeff);
LOG(L, R, cnt);
ans += (get_sum1(R, 0) - get_sum1(R - cnt, cnt)) * coeff;
LOG(ans, get_sum1(R, 0));
ans -= (get_sum2(L - 1, 0) - get_sum2(L - 1 + cnt, cnt)) * coeff;
// int to = L - 1 + cnt;
// if (to > c[3]) {
// ans -= pref.back() * get_pref(cnt - (to - c[3] - 1), cnt) * coeff;
// }
LOG("end", ans);
}
}
}
LOG(ans);
auto solve = [&] (int A, int B) {
int have[2] = {};
for (int i = 0; i < n; i++) {
++have[a[A].second[i] != a[B].second[i]];
}
for (int x = 0; x <= have[0]; x++) {
for (int y = 0; y <= have[1]; y++) {
if (x + y <= a[A].first && x + have[1] - y <= a[B].first) {
ans -= C(have[0], x) * C(have[1], y);
}
}
}
};
solve(0, 1);
solve(0, 2);
solve(1, 2);
cout << ans << '\n';
if (debug) {
int res = 0;
for (int mask = 0; mask < (1 << n); mask++) {
int h[3] = {};
for (int j = 0; j < n; j++) {
char cur = '0' + bool(mask & (1 << j));
if (cur != a[0].second[j]) ++h[0];
if (cur != a[1].second[j]) ++h[1];
if (cur != a[2].second[j]) ++h[2];
}
if (h[0] <= a[0].first || h[1] <= a[1].first || h[2] <= a[2].first) {
++res;
}
}
LOG(ans, res);
if (ans != res) {
LOG(n);
for (int i = 0; i < 3; i++) {
LOG(a[i].first, a[i].second);
}
}
assert(ans == res);
goto m1;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3624kb
input:
3 1 000 1 100 0 111
output:
7
result:
ok answer is '7'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
5 2 10110 0 11010 1 00000
output:
19
result:
ok answer is '19'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 2 011 0 100 3 010
output:
8
result:
ok answer is '8'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
5 1 11010 3 00001 4 01011
output:
32
result:
ok answer is '32'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1 1 1 1 1 1 0
output:
2
result:
ok answer is '2'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
1 1 0 0 1 1 0
output:
2
result:
ok answer is '2'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
10 4 0001001011 6 0000011100 4 1011000101
output:
969
result:
ok answer is '969'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
15 4 110001100010010 11 101101011011001 0 001110001001110
output:
32227
result:
ok answer is '32227'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
15 9 011001010111000 7 101000010111010 9 010000110010010
output:
31656
result:
ok answer is '31656'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
15 15 011010001011011 6 101000010001001 6 000010111110010
output:
32768
result:
ok answer is '32768'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
15 0 100010010001000 0 011100000001011 0 100000100111111
output:
3
result:
ok answer is '3'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
14 0 11101010011000 0 11101010011000 0 11101010011000
output:
1
result:
ok answer is '1'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
37 28 1001101111100111110011111100101110110 32 1001011110011111110100111110100110010 21 1001000111000000110011000001100011111
output:
438952513
result:
ok answer is '438952513'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
37 21 0101010101010101010101010101010101010 20 0011001100110011001100110011001100110 22 0000111100001111000011110000111100001
output:
16781879
result:
ok answer is '16781879'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
36 14 001110110001000000000111001011111101 13 100000010110111010011100111111010100 12 011111111010110111110010110011100100
output:
765072297
result:
ok answer is '765072297'
Test #16:
score: 0
Accepted
time: 8ms
memory: 4596kb
input:
1500 653 101110010010011101100010011000000111010100100001101000000010010011001011101111100111100101000111001110000011111110011010101011111101001011011001100010100100101100100101000010001101011111100001010000101000100110110001011011001111100001010110101000000111010111001011110011110100110101111111110...
output:
979972096
result:
ok answer is '979972096'
Test #17:
score: 0
Accepted
time: 9ms
memory: 4452kb
input:
1500 1207 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
247669529
result:
ok answer is '247669529'
Test #18:
score: 0
Accepted
time: 20ms
memory: 4580kb
input:
1500 941 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010...
output:
79895166
result:
ok answer is '79895166'
Test #19:
score: 0
Accepted
time: 8ms
memory: 4156kb
input:
1499 456 011101011010100010100001001011011101110111010101011100011111011000000010100101010011011010110000111010110011101101100001110101000110111011110111111011101111001111011111011111011101000011001111110110011100101001111000110111001100101111011011110100000010010111011001101010001011000010111111001...
output:
552712832
result:
ok answer is '552712832'
Test #20:
score: 0
Accepted
time: 8ms
memory: 5276kb
input:
1500 691 000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
64511838
result:
ok answer is '64511838'
Test #21:
score: 0
Accepted
time: 12ms
memory: 3680kb
input:
1500 611 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
922073180
result:
ok answer is '922073180'
Test #22:
score: 0
Accepted
time: 10ms
memory: 5328kb
input:
1500 899 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
704491497
result:
ok answer is '704491497'
Test #23:
score: 0
Accepted
time: 8ms
memory: 3668kb
input:
1500 741 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
492637609
result:
ok answer is '492637609'
Test #24:
score: 0
Accepted
time: 690ms
memory: 199308kb
input:
10000 4981 0011101110100100111100011000101000111100111101000011101011001100100010101001100000100101110010100000010010101011000010100001000001000000101101000101000111010001000111001100100101100000100011010101010110011011100010111011000100010001010001100001010110110100100111011101110010110100010011001...
output:
959078599
result:
ok answer is '959078599'
Test #25:
score: 0
Accepted
time: 190ms
memory: 3784kb
input:
10000 5459 0000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110...
output:
344807402
result:
ok answer is '344807402'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3892kb
input:
9999 1209 10110111111110000100110101111100010100000010000110110010011001111001110101110110000000000011001001110010101010011001100100001001110100010011100000110010101000100111100011000110001100010101011111001111010111110011111011110100100010101111111100111001001100000000001100000001001000001110001001...
output:
65860179
result:
ok answer is '65860179'
Test #27:
score: 0
Accepted
time: 89ms
memory: 3988kb
input:
10000 1017 1101000001010000010010101100011111001101011000111010110101001110111001111000010110100110001010111010001010100100110011001010000111100000001010000010011010010111101010001001100001110110001101010101111000101100100011110100000011000101011101110001101110110010011110100010110000001110011110110...
output:
42195644
result:
ok answer is '42195644'
Test #28:
score: 0
Accepted
time: 540ms
memory: 3984kb
input:
10000 9389 0110011010110001101100101101100100101110101000101111010000100100100000101111010111010010100100010100110011101011101001111101011111000110000000101000001111100110011100011010100010011010101000000110001001001100011000011000101000010011110000001111101011011101011100111010001100011100001111000...
output:
905611805
result:
ok answer is '905611805'
Test #29:
score: 0
Accepted
time: 251ms
memory: 51064kb
input:
10000 427 00100011101100111001011001111110000110011011101000000010110111010000011000110111111110000110101001100010001010111101111110101100110101111100110110110100000101000001001010110001111100110101100011101011010100111011100111100001011010011000101011101000101010010011001100101000011110000000101000...
output:
307932648
result:
ok answer is '307932648'
Test #30:
score: 0
Accepted
time: 12ms
memory: 3748kb
input:
10000 493 11010111000000100111101101110111100010010011011100100110100011100010111011111100100101001101000101001111100000110000100011011001000101110101100101101010010010100001010010100000110100011000011110010110101101011001010111001111110110000001101010010111111011100000011111110010111111011100110111...
output:
474080436
result:
ok answer is '474080436'
Test #31:
score: 0
Accepted
time: 35ms
memory: 15292kb
input:
9999 500 000100110101010110100100011010011000001110100101100001100110111100000110101100010001100001100100100100010011011111001101110000010100100000111001010101001010011000011101010101011000111111100100001010000010110101111000110101001100000101011110010011011111011011001100110001101100000010001000101...
output:
37344147
result:
ok answer is '37344147'
Test #32:
score: 0
Accepted
time: 48ms
memory: 20660kb
input:
10000 500 01001111011100010101010001001101000111110101101010010101010111010010000101001010100101001111011111001010000111000001100110001001011011011101110000000010001000101111010011001010010001001001111100101000000101101100100010101000011001010100111111101111101001111011101111110001100110110001010101...
output:
615112513
result:
ok answer is '615112513'
Test #33:
score: 0
Accepted
time: 7ms
memory: 3956kb
input:
849 424 0101100111001111001000111010000101110011000101111111010100100100111111001101101100101010101111010001111000111111101010100000111101001011010110000001100011001000101111101100100100111000100110001100101011000100010000011101010011110111110101110010011010011011010111110010110011111111001101110101...
output:
448547897
result:
ok answer is '448547897'
Test #34:
score: 0
Accepted
time: 189ms
memory: 29264kb
input:
7500 1400 11111001101100101010010111000000001101011000101100101110000010101110000011111110001000110011001111111000110001100111101001011010001001000101001101110011011010111111110100010111100011100101011001111001000011110011011111111000100011111101101100010011010010101001111110110001010011111111010010...
output:
986734000
result:
ok answer is '986734000'
Test #35:
score: 0
Accepted
time: 405ms
memory: 31416kb
input:
7500 3145 11111111111001010101010111001011110000000001100010001011110101100000001001000110000101011010111110101001101100000111111100011001000000111110001011101101000001101100001011100000000011101011011011011011011000010110111101111010101110110010100111011000101001011101001000100101100101111001011111...
output:
275607354
result:
ok answer is '275607354'
Test #36:
score: 0
Accepted
time: 374ms
memory: 30884kb
input:
7499 3700 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
289896285
result:
ok answer is '289896285'
Test #37:
score: 0
Accepted
time: 146ms
memory: 4536kb
input:
7500 4082 11111111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111...
output:
642729874
result:
ok answer is '642729874'
Test #38:
score: 0
Accepted
time: 131ms
memory: 3740kb
input:
7500 3289 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
780863390
result:
ok answer is '780863390'
Test #39:
score: 0
Accepted
time: 102ms
memory: 4008kb
input:
7500 3489 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
455112837
result:
ok answer is '455112837'
Test #40:
score: 0
Accepted
time: 116ms
memory: 4376kb
input:
7500 3744 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
229093592
result:
ok answer is '229093592'
Test #41:
score: 0
Accepted
time: 381ms
memory: 113480kb
input:
7500 3576 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
216011967
result:
ok answer is '216011967'
Test #42:
score: 0
Accepted
time: 125ms
memory: 4084kb
input:
7500 3608 11111111111111111111111111111111110111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111...
output:
923560388
result:
ok answer is '923560388'
Test #43:
score: 0
Accepted
time: 336ms
memory: 39824kb
input:
8500 1976 00101110101000100010010110111011011111110111111000110011101110011011000001101001001110110011100010111000111110010101011110011101100000011000110100011110110011000011011100100110111110010011001000011111010011101101101001101000111010000010000100001010000101100010111000101011000110101001110001...
output:
469555308
result:
ok answer is '469555308'
Test #44:
score: 0
Accepted
time: 622ms
memory: 39832kb
input:
8499 4082 00100001001111111000011101010010011001111010111001100000100111001010111011010000011000011100101101011101000011011000110011100000000110000010100101101111011000101001000101010111111111100101000000010101010011100010101111111010100110010010010010111011001001100011000101011110011010100101110111...
output:
110187869
result:
ok answer is '110187869'
Test #45:
score: 0
Accepted
time: 512ms
memory: 38816kb
input:
8500 4311 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
808274337
result:
ok answer is '808274337'
Test #46:
score: 0
Accepted
time: 424ms
memory: 37856kb
input:
8500 4018 01111010010011111010010110101111011010110011101010100100010010101110001001110011110000010110101000110111110010111011110001111111010001101011111110111101100110101010011110000010110100111000101111010110101101010000100001010110111001011110001001101010100100010011010111111001000101001100010001...
output:
757786705
result:
ok answer is '757786705'
Test #47:
score: 0
Accepted
time: 491ms
memory: 144908kb
input:
8500 3878 10101010010010000000101011101010011100111001110100000100011010110111110001001001010010011000101000000000101010000010011000000110100100101001100011000011011100010111101000110011101000000010101101101100000011001001001101010101000010111000011100000001010101111100001011010010100111111001110011...
output:
982240625
result:
ok answer is '982240625'
Test #48:
score: 0
Accepted
time: 474ms
memory: 42412kb
input:
8877 4541 11101110001101110001001110010000000010000101100011111000111011101000111111001001011010101010110010000010100101100110100000100101010000010001001000110100101001100001100010010000011110010100000100110000011001100001110111011100101100001100111111110110101110001100011011101001100101101110011001...
output:
115865163
result:
ok answer is '115865163'
Test #49:
score: 0
Accepted
time: 627ms
memory: 42152kb
input:
9000 4785 11111000001001111000010110101100001101111111110110100010000100001001101001111100000111100001101110101100001101111110001001101100000001010110110101100111110100010010111101011000111111010011110001111001111001111001101011000000100101001001001010111011011111101110011001110001011000100000101000...
output:
801204767
result:
ok answer is '801204767'
Test #50:
score: 0
Accepted
time: 562ms
memory: 43104kb
input:
9000 4500 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
20729137
result:
ok answer is '20729137'
Test #51:
score: 0
Accepted
time: 866ms
memory: 45896kb
input:
9500 6148 11010101001110111110100000101010111100100110101011011011001010110101010100111010011011011010101100110110111110111101101111111111111101000101100111011110000000010100110011110110110100110110001010010100010010000001111010011001100010000010011001010110101111101011011100011110001101001111011111...
output:
559635101
result:
ok answer is '559635101'
Test #52:
score: 0
Accepted
time: 779ms
memory: 47700kb
input:
9500 5678 11100110001001011100111000011001011100010110000000100101101111110001110110000000100110010100101001010000000001101101100100101100000111101111010011100000110000010101011001010000110110000011100000000111010111011011101010011111010101011111110000000001001010100001110000110001110000110111001110...
output:
16331151
result:
ok answer is '16331151'
Test #53:
score: 0
Accepted
time: 1014ms
memory: 46652kb
input:
9500 9500 10101011011100101000001000100001000000011000010011011110100000001001001000011110101110010111011110101010111111110100000000011011000011101101010110100011111100001111100111011010000100010000111101111111101100011000001001010101101110100010011110011000110101011011000101110011010001011101010011...
output:
16331151
result:
ok answer is '16331151'
Test #54:
score: 0
Accepted
time: 625ms
memory: 47512kb
input:
9499 4742 01000011101001001001010110110100111111000000110100000011010010011010011000110011111011111001000100101000111000001110001111001010000001110010011100111001111111100110100101100001000101011011010111000110101001001001101011101010101110111001101001100000010101100010110110110100010011010001110110...
output:
525027554
result:
ok answer is '525027554'
Test #55:
score: 0
Accepted
time: 315ms
memory: 46772kb
input:
9500 776 000100100010101101101100101100101110100000111011010000100111101010000011111011101011111000110001001000101101011010000000010100010010111010111101110100010110101110101001100110100001000111011001101111110111100000000000111001000011101110010101111001100110001111010000000000010100110111011110001...
output:
232844204
result:
ok answer is '232844204'
Test #56:
score: 0
Accepted
time: 486ms
memory: 48892kb
input:
9500 6667 01110110010011000110001010111100110101001011101110101000111111010001011100101100011110000011100100110111100010110001011111101001000011011111110101011001000110010100000011001000100011011111110101100010101011100100101001110110101011011111100011011010101110111010100001110001100011110100010010...
output:
457696254
result:
ok answer is '457696254'
Test #57:
score: 0
Accepted
time: 938ms
memory: 46524kb
input:
9500 8010 01110111110101100101001000111011010011101110001101011010101100000101110000001110001100101101000111000001110100100011000101001010011111010111001110101001000100111010100110111000111110100111111101000100101110010110100101110100011101101100100010010000001101010100100110010111111101110000001100...
output:
16331151
result:
ok answer is '16331151'
Test #58:
score: 0
Accepted
time: 224ms
memory: 48640kb
input:
9500 186 010001010000000101100101011000100001010100011111101010111100111010010011011111011010010010100001101111100110001101111111000101011101001001111101010100101111101101111111100001001101011111000101000000100001101100100110011110011101011101100000000000110010011100101010100110011001000010011101000...
output:
725486382
result:
ok answer is '725486382'
Test #59:
score: 0
Accepted
time: 2ms
memory: 3800kb
input:
9500 4280 10001111001101100010101110100101010010010110001010110010011100010101011000110000100100010101111101110110110101111011101101111101110010000110000000000110000011000111111111111001100100011000110111111101100111011001111100001010101111111110101101001111111101101100101001111001111101101110000010...
output:
287640234
result:
ok answer is '287640234'
Test #60:
score: 0
Accepted
time: 696ms
memory: 51216kb
input:
10000 5000 1111110000111010110010010011000001101011011100001000110000011111111001010111101110101111100111110000001010111110100011010011111000000011110111001101110010010011000011110110110101101111000110111111100000011010111110110010000011110101001010000110011001001011000110101011110111000000011010000...
output:
555342041
result:
ok answer is '555342041'
Test #61:
score: 0
Accepted
time: 504ms
memory: 52508kb
input:
10000 635 01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
output:
905611805
result:
ok answer is '905611805'
Test #62:
score: 0
Accepted
time: 225ms
memory: 4232kb
input:
10000 1963 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
152806915
result:
ok answer is '152806915'
Test #63:
score: 0
Accepted
time: 89ms
memory: 3776kb
input:
10000 1490 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
34746472
result:
ok answer is '34746472'
Test #64:
score: 0
Accepted
time: 268ms
memory: 4172kb
input:
10000 6251 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
905611805
result:
ok answer is '905611805'
Test #65:
score: 0
Accepted
time: 506ms
memory: 89992kb
input:
10000 4712 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
245781229
result:
ok answer is '245781229'
Test #66:
score: 0
Accepted
time: 728ms
memory: 4084kb
input:
10000 5179 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000...
output:
440035611
result:
ok answer is '440035611'
Test #67:
score: 0
Accepted
time: 256ms
memory: 51800kb
input:
10000 760 11010000010110010110110101001001100100001111100101000110000000111000000101110101101111100011010110000011111011011011011101010111011110000111000101000001111000101010011000101010110101101010101000011001110110011101001001011011000101001011101001100100100101100110101100011001001010111011011001...
output:
588770127
result:
ok answer is '588770127'
Test #68:
score: 0
Accepted
time: 1111ms
memory: 54084kb
input:
10000 9377 0010011100101000010001000011100111000000111100101010100110110010000011000100101000100100100001010100100000001001100101010010011011001101100111110000110011101111100101111001111100010101111110111101001001111101001011010111101101011001110101010010001001010111000100111001111000001011010100011...
output:
905611805
result:
ok answer is '905611805'