QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#182468 | #4893. Imbalance | hos_lyric | 40 | 1820ms | 10900kb | C++14 | 8.6kb | 2023-09-18 03:46:47 | 2023-09-18 03:46:47 |
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; }
#define COLOR(s) ("\x1b[" s "m")
////////////////////////////////////////////////////////////////////////////////
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 = 998244353;
using Mint = ModInt<MO>;
Mint det(vector<vector<Mint>> a) {
const int n = a.size();
Mint ret = 1;
for (int h = 0; h < n; ++h) {
for (int i = h; i < n; ++i) if (a[i][h]) {
if (h != i) {
swap(a[h], a[i]);
ret = -ret;
}
break;
}
ret *= a[h][h];
if (!ret) break;
const Mint s = a[h][h].inv();
for (int j = h + 1; j < n; ++j) a[h][j] *= s;
for (int i = h + 1; i < n; ++i) {
const Mint t = a[i][h];
if (t) for (int j = h + 1; j < n; ++j) a[i][j] -= t * a[h][j];
}
}
return ret;
}
int N, K, M;
char S[120];
namespace small_k {
Mint run() {
vector<char> ban(1 << K, 0);
for (int p = 0; p < 1 << K; ++p) {
ban[p] = (2 * __builtin_popcount(p) == K);
}
vector<Mint> crt(1 << (K-1), 0), nxt(1 << K, 0);
crt[0] = 1;
for (int i = 0; i < N; ++i) {
fill(nxt.begin(), nxt.end(), 0);
for (int p = 0; p < 1 << (K-1); ++p) {
for (int a = 0; a < 2; ++a) if (i >= M || S[i] - '0' == a) {
nxt[p << 1 | a] += crt[p];
}
}
if (i + 1 >= K) {
for (int p = 0; p < 1 << K; ++p) if (ban[p]) {
nxt[p] = 0;
}
}
for (int p = 0; p < 1 << (K-1); ++p) {
crt[p] = nxt[p] + nxt[p | 1 << (K-1)];
}
}
Mint ans = 0;
for (int p = 0; p < 1 << (K-1); ++p) {
ans += crt[p];
}
return ans;
}
} // small_k
/*
assume 1: always fewer
s[i]: # of 1's in [0, i)
s[i + 1] - s[i] \in [0, 1]
s[i + K] - s[i] \in [0, K/2)
path j: from (0, s[j K] - j (K/2)) to (K, s[(j+1) K] - j (K/2))
*/
namespace large_k {
int J, Y0, Y1;
vector<int> SX, SY, TX, TY;
bool ban[120][120];
template <class T> void doDP(int sx, int sy, T ret) {
sy -= Y0;
if (ban[sx][sy]) return;
ret[sx][sy] = 1;
for (int x = sx; x < K; ++x) for (int y = 0; y <= Y1 - Y0; ++y) if (ret[x][y]) {
if (!ban[x + 1][y ]) ret[x + 1][y ] += ret[x][y];
if (!ban[x + 1][y + 1]) ret[x + 1][y + 1] += ret[x][y];
}
}
Mint dp0[120][120];
Mint dp[120][120][120];
Mint solve() {
{
const int dx = TX[J - 1] - SX[J - 1];
const int dy = TY[J - 1] - SY[J - 1];
if (!(0 <= dy && dy <= dx)) {
return 0;
}
}
vector<vector<Mint>> a(J, vector<Mint>(J));
for (int j1 = 0; j1 < J; ++j1) {
a[0][j1] = dp0[TX[j1]][TY[j1] - Y0];
}
for (int j0 = 1; j0 < J; ++j0) for (int j1 = 0; j1 < J; ++j1) {
a[j0][j1] = dp[SY[j0] - Y0][TX[j1]][TY[j1] - Y0];
}
const Mint res = det(a);
// cerr<<COLOR("32")<<"[solve]"<<COLOR()<<endl;
// cerr<<"SX = "<<SX<<", TX = "<<TX<<endl;
// cerr<<"SY = "<<SY<<", TY = "<<TY<<endl;
// cerr<<"a = "<<a<<endl;
// cerr<<"res = "<<res<<endl;
return res;
}
// s: s[j - 1]
Mint dfs(int j, int s) {
if (j == J) {
return solve();
} else {
Mint ret = 0;
for (int ss = s; ss < s + K/2; ++ss) {
TY[j - 1] = ss - (j - 1) * (K/2);
SY[j] = ss - j * (K/2);
ret += dfs(j + 1, ss);
}
return ret;
}
}
Mint run() {
J = (N + K - 1) / K;
Y0 = -(J - 1) * (K/2);
Y1 = K/2;
cerr<<"J = "<<J<<", Y0 = "<<Y0<<", Y1 = "<<Y1<<endl;
// Y1 - Y0 <= J (K/2) < (N/K + 1) (K/2) < N/2 + K/2 < N
assert(Y1 - Y0 <= N);
SX.assign(J, 0);
SY.assign(J, 1001001001);
TX.assign(J, K);
TY.assign(J, 1001001001);
SX[0] = M;
TX[J - 1] = N - (J - 1) * K;
Mint ans = 0;
for (int few = 0; few < 2; ++few) {
// cerr<<COLOR("93")<<"few = "<<few<<COLOR()<<endl;
SY[0] = count(S, S + M, '0' + few);
for (int &ty = TY[J - 1] = Y0; ty <= -(J - 1) + min(TX[J - 1], K/2 - 1); ++ty) {
// cerr<<" ty = "<<ty<<endl;
// ban to ensure non-intersecting <=> id perm
memset(ban, 0, sizeof(ban));
for (int y = SY[0] + 1; y <= Y1; ++y) ban[SX[0]][y - Y0] = true;
for (int y = Y0; y < TY[J - 1]; ++y) ban[TX[J - 1]][y - Y0] = true;
{
int y = 0;
for (int x = 0; x < M; ++x) {
ban[x][y - Y0] = true;
if (S[x] - '0' == few) ++y;
}
}
// cerr<<" SX = "<<SX<<", TX = "<<TX<<endl;
// cerr<<" SY = "<<SY<<", TY = "<<TY<<endl;
// cerr<<" ban = "<<endl;for(int x=0;x<=K;++x){cerr<<" ";pv(ban[x],ban[x]+(Y1-Y0+1));}
memset(dp0, 0, sizeof(dp0));
memset(dp, 0, sizeof(dp));
doDP(SX[0], SY[0], dp0);
for (int y = Y0; y <= Y1; ++y) {
doDP(0, y, dp[y - Y0]);
}
ans += dfs(1, 0);
}
}
return ans;
}
} // large_k
int main() {
for (; ~scanf("%d%d%d", &N, &K, &M); ) {
if (M) {
scanf("%s", S);
} else {
S[0] = 0;
}
cerr<<COLOR("33")<<"N = "<<N<<", K = "<<K<<", M = "<<M<<", S = "<<S<<COLOR()<<endl;
Mint ans = 0;
if(0){// if (K <= 20) {
ans = small_k::run();
} else {
ans = large_k::run();
}
printf("%u\n", ans.x);
#ifdef LOCAL
const Mint brt=small_k::run();
if(brt!=ans)cerr<<N<<" "<<K<<" "<<M<<" "<<S<<": "<<brt<<" "<<ans<<endl;
assert(brt==ans);
#endif
}
return 0;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 2ms
memory: 10604kb
input:
2 2 0
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 2ms
memory: 10560kb
input:
2 2 1 0
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 2ms
memory: 10600kb
input:
3 2 0
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 2ms
memory: 10628kb
input:
3 2 1 0
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 2ms
memory: 10592kb
input:
4 2 0
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 2ms
memory: 10696kb
input:
4 2 1 0
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 2ms
memory: 10848kb
input:
4 4 0
output:
10
result:
ok 1 number(s): "10"
Test #8:
score: 0
Accepted
time: 0ms
memory: 10628kb
input:
4 4 1 1
output:
5
result:
ok 1 number(s): "5"
Test #9:
score: 0
Accepted
time: 2ms
memory: 10660kb
input:
4 4 2 00
output:
3
result:
ok 1 number(s): "3"
Test #10:
score: 0
Accepted
time: 2ms
memory: 10880kb
input:
4 4 3 101
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 2ms
memory: 10624kb
input:
5 2 0
output:
2
result:
ok 1 number(s): "2"
Test #12:
score: 0
Accepted
time: 2ms
memory: 10600kb
input:
5 2 1 1
output:
1
result:
ok 1 number(s): "1"
Test #13:
score: 0
Accepted
time: 3ms
memory: 10596kb
input:
5 4 0
output:
14
result:
ok 1 number(s): "14"
Test #14:
score: 0
Accepted
time: 3ms
memory: 10552kb
input:
5 4 1 0
output:
7
result:
ok 1 number(s): "7"
Test #15:
score: 0
Accepted
time: 0ms
memory: 10596kb
input:
5 4 2 01
output:
3
result:
ok 1 number(s): "3"
Test #16:
score: 0
Accepted
time: 0ms
memory: 10880kb
input:
5 4 3 110
output:
1
result:
ok 1 number(s): "1"
Test #17:
score: 0
Accepted
time: 2ms
memory: 10684kb
input:
17 2 0
output:
2
result:
ok 1 number(s): "2"
Test #18:
score: 0
Accepted
time: 2ms
memory: 10900kb
input:
17 2 0
output:
2
result:
ok 1 number(s): "2"
Test #19:
score: 0
Accepted
time: 3ms
memory: 10624kb
input:
17 10 6 110111
output:
621
result:
ok 1 number(s): "621"
Test #20:
score: 0
Accepted
time: 6ms
memory: 10684kb
input:
17 10 2 11
output:
8413
result:
ok 1 number(s): "8413"
Test #21:
score: 0
Accepted
time: 2ms
memory: 10620kb
input:
18 2 1 1
output:
1
result:
ok 1 number(s): "1"
Test #22:
score: 0
Accepted
time: 0ms
memory: 10888kb
input:
18 2 1 1
output:
1
result:
ok 1 number(s): "1"
Test #23:
score: 0
Accepted
time: 6ms
memory: 10896kb
input:
18 8 5 00010
output:
918
result:
ok 1 number(s): "918"
Test #24:
score: 0
Accepted
time: 6ms
memory: 10600kb
input:
18 8 3 001
output:
3404
result:
ok 1 number(s): "3404"
Test #25:
score: 0
Accepted
time: 6ms
memory: 10628kb
input:
18 16 6 100011
output:
2458
result:
ok 1 number(s): "2458"
Test #26:
score: 0
Accepted
time: 3ms
memory: 10624kb
input:
18 16 8 00101101
output:
548
result:
ok 1 number(s): "548"
Test #27:
score: 0
Accepted
time: 2ms
memory: 10880kb
input:
19 2 1 1
output:
1
result:
ok 1 number(s): "1"
Test #28:
score: 0
Accepted
time: 0ms
memory: 10692kb
input:
19 2 0
output:
2
result:
ok 1 number(s): "2"
Test #29:
score: 0
Accepted
time: 5ms
memory: 10896kb
input:
19 6 2 00
output:
3413
result:
ok 1 number(s): "3413"
Test #30:
score: 0
Accepted
time: 3ms
memory: 10880kb
input:
19 6 1 1
output:
7012
result:
ok 1 number(s): "7012"
Test #31:
score: 0
Accepted
time: 7ms
memory: 10892kb
input:
19 12 10 1010110000
output:
266
result:
ok 1 number(s): "266"
Test #32:
score: 0
Accepted
time: 3ms
memory: 10628kb
input:
19 12 3 111
output:
19234
result:
ok 1 number(s): "19234"
Test #33:
score: 0
Accepted
time: 6ms
memory: 10632kb
input:
19 16 2 10
output:
77876
result:
ok 1 number(s): "77876"
Test #34:
score: 0
Accepted
time: 7ms
memory: 10596kb
input:
19 16 0
output:
301208
result:
ok 1 number(s): "301208"
Test #35:
score: 0
Accepted
time: 0ms
memory: 10556kb
input:
20 2 1 0
output:
1
result:
ok 1 number(s): "1"
Test #36:
score: 0
Accepted
time: 2ms
memory: 10884kb
input:
20 2 0
output:
2
result:
ok 1 number(s): "2"
Test #37:
score: 0
Accepted
time: 3ms
memory: 10856kb
input:
20 10 9 110111000
output:
76
result:
ok 1 number(s): "76"
Test #38:
score: 0
Accepted
time: 3ms
memory: 10880kb
input:
20 10 9 110101110
output:
372
result:
ok 1 number(s): "372"
Test #39:
score: 0
Accepted
time: 4ms
memory: 10536kb
input:
20 14 11 10110110000
output:
207
result:
ok 1 number(s): "207"
Test #40:
score: 0
Accepted
time: 8ms
memory: 10604kb
input:
20 14 7 0011011
output:
3675
result:
ok 1 number(s): "3675"
Test #41:
score: 0
Accepted
time: 6ms
memory: 10600kb
input:
20 20 14 10111010000000
output:
58
result:
ok 1 number(s): "58"
Subtask #2:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Test #42:
score: 0
Time Limit Exceeded
input:
114 12 11 11010000010
output:
result:
Subtask #3:
score: 30
Accepted
Dependency #1:
100%
Accepted
Test #84:
score: 30
Accepted
time: 22ms
memory: 10620kb
input:
66 20 5 11001
output:
286180948
result:
ok 1 number(s): "286180948"
Test #85:
score: 0
Accepted
time: 22ms
memory: 10852kb
input:
66 20 19 0101001111011100100
output:
334317215
result:
ok 1 number(s): "334317215"
Test #86:
score: 0
Accepted
time: 19ms
memory: 10628kb
input:
66 22 19 1001101100000100001
output:
465510840
result:
ok 1 number(s): "465510840"
Test #87:
score: 0
Accepted
time: 18ms
memory: 10692kb
input:
66 22 11 10001111000
output:
731812403
result:
ok 1 number(s): "731812403"
Test #88:
score: 0
Accepted
time: 17ms
memory: 10628kb
input:
66 24 6 011111
output:
270615978
result:
ok 1 number(s): "270615978"
Test #89:
score: 0
Accepted
time: 21ms
memory: 10600kb
input:
66 24 6 010001
output:
800866476
result:
ok 1 number(s): "800866476"
Test #90:
score: 0
Accepted
time: 19ms
memory: 10632kb
input:
66 26 11 01110011011
output:
292876310
result:
ok 1 number(s): "292876310"
Test #91:
score: 0
Accepted
time: 23ms
memory: 10848kb
input:
66 26 3 110
output:
269818127
result:
ok 1 number(s): "269818127"
Test #92:
score: 0
Accepted
time: 20ms
memory: 10628kb
input:
66 28 22 1111000101010111010110
output:
25687950
result:
ok 1 number(s): "25687950"
Test #93:
score: 0
Accepted
time: 23ms
memory: 10684kb
input:
66 28 7 0010101
output:
21960392
result:
ok 1 number(s): "21960392"
Test #94:
score: 0
Accepted
time: 18ms
memory: 10628kb
input:
66 30 16 1111000000011010
output:
599613456
result:
ok 1 number(s): "599613456"
Test #95:
score: 0
Accepted
time: 18ms
memory: 10600kb
input:
66 30 22 0010101110011001011100
output:
332331060
result:
ok 1 number(s): "332331060"
Test #96:
score: 0
Accepted
time: 21ms
memory: 10680kb
input:
66 32 12 011100101111
output:
692517940
result:
ok 1 number(s): "692517940"
Test #97:
score: 0
Accepted
time: 21ms
memory: 10624kb
input:
66 32 16 0100100100101001
output:
967944648
result:
ok 1 number(s): "967944648"
Test #98:
score: 0
Accepted
time: 23ms
memory: 10592kb
input:
65 20 1 1
output:
42155886
result:
ok 1 number(s): "42155886"
Test #99:
score: 0
Accepted
time: 21ms
memory: 10632kb
input:
65 20 17 10010110011011111
output:
178005033
result:
ok 1 number(s): "178005033"
Test #100:
score: 0
Accepted
time: 18ms
memory: 10880kb
input:
65 22 16 0001011100100000
output:
785335838
result:
ok 1 number(s): "785335838"
Test #101:
score: 0
Accepted
time: 18ms
memory: 10624kb
input:
65 22 13 1001101010101
output:
440523928
result:
ok 1 number(s): "440523928"
Test #102:
score: 0
Accepted
time: 20ms
memory: 10628kb
input:
65 24 0
output:
477090711
result:
ok 1 number(s): "477090711"
Test #103:
score: 0
Accepted
time: 21ms
memory: 10696kb
input:
65 24 14 10111111011101
output:
263900154
result:
ok 1 number(s): "263900154"
Test #104:
score: 0
Accepted
time: 19ms
memory: 10632kb
input:
65 26 10 1100111010
output:
343121911
result:
ok 1 number(s): "343121911"
Test #105:
score: 0
Accepted
time: 23ms
memory: 10596kb
input:
65 26 2 01
output:
1028654
result:
ok 1 number(s): "1028654"
Test #106:
score: 0
Accepted
time: 23ms
memory: 10628kb
input:
65 28 11 00010110101
output:
977003245
result:
ok 1 number(s): "977003245"
Test #107:
score: 0
Accepted
time: 19ms
memory: 10596kb
input:
65 28 25 1010000011011011000010010
output:
59779597
result:
ok 1 number(s): "59779597"
Test #108:
score: 0
Accepted
time: 22ms
memory: 10632kb
input:
65 30 12 011010110110
output:
28981686
result:
ok 1 number(s): "28981686"
Test #109:
score: 0
Accepted
time: 18ms
memory: 10600kb
input:
65 30 5 01111
output:
901067934
result:
ok 1 number(s): "901067934"
Test #110:
score: 0
Accepted
time: 14ms
memory: 10620kb
input:
65 32 9 101100011
output:
523898023
result:
ok 1 number(s): "523898023"
Test #111:
score: 0
Accepted
time: 16ms
memory: 10888kb
input:
65 32 31 1010100001010000110110000001000
output:
173664576
result:
ok 1 number(s): "173664576"
Test #112:
score: 0
Accepted
time: 19ms
memory: 10852kb
input:
64 20 2 10
output:
213928626
result:
ok 1 number(s): "213928626"
Test #113:
score: 0
Accepted
time: 23ms
memory: 10696kb
input:
64 20 17 01110111010001000
output:
629845990
result:
ok 1 number(s): "629845990"
Test #114:
score: 0
Accepted
time: 19ms
memory: 10892kb
input:
64 22 4 0101
output:
755608618
result:
ok 1 number(s): "755608618"
Test #115:
score: 0
Accepted
time: 18ms
memory: 10696kb
input:
64 22 20 00010010100011111010
output:
381748139
result:
ok 1 number(s): "381748139"
Test #116:
score: 0
Accepted
time: 20ms
memory: 10852kb
input:
64 24 9 100110100
output:
508203808
result:
ok 1 number(s): "508203808"
Test #117:
score: 0
Accepted
time: 17ms
memory: 10600kb
input:
64 24 17 11100000110000111
output:
271951917
result:
ok 1 number(s): "271951917"
Test #118:
score: 0
Accepted
time: 22ms
memory: 10880kb
input:
64 26 16 1100111111111110
output:
947719454
result:
ok 1 number(s): "947719454"
Test #119:
score: 0
Accepted
time: 23ms
memory: 10624kb
input:
64 26 18 101001101111101011
output:
557651914
result:
ok 1 number(s): "557651914"
Test #120:
score: 0
Accepted
time: 18ms
memory: 10884kb
input:
64 28 7 0011101
output:
659928242
result:
ok 1 number(s): "659928242"
Test #121:
score: 0
Accepted
time: 19ms
memory: 10600kb
input:
64 28 10 1100010011
output:
724166061
result:
ok 1 number(s): "724166061"
Test #122:
score: 0
Accepted
time: 20ms
memory: 10628kb
input:
64 30 2 10
output:
922542306
result:
ok 1 number(s): "922542306"
Test #123:
score: 0
Accepted
time: 21ms
memory: 10600kb
input:
64 30 2 10
output:
922542306
result:
ok 1 number(s): "922542306"
Test #124:
score: 0
Accepted
time: 14ms
memory: 10880kb
input:
64 32 14 00100000110010
output:
772135024
result:
ok 1 number(s): "772135024"
Test #125:
score: 0
Accepted
time: 15ms
memory: 10576kb
input:
64 32 19 0110111111001010010
output:
301836349
result:
ok 1 number(s): "301836349"
Test #126:
score: 0
Accepted
time: 28ms
memory: 10604kb
input:
66 48 10 1100101011
output:
250609010
result:
ok 1 number(s): "250609010"
Test #127:
score: 0
Accepted
time: 20ms
memory: 10900kb
input:
66 66 29 01110011011101001000011110101
output:
746018049
result:
ok 1 number(s): "746018049"
Test #128:
score: 0
Accepted
time: 43ms
memory: 10628kb
input:
66 14 7 1001101
output:
871164400
result:
ok 1 number(s): "871164400"
Test #129:
score: 0
Accepted
time: 21ms
memory: 10628kb
input:
66 24 1 0
output:
584525706
result:
ok 1 number(s): "584525706"
Test #130:
score: 0
Accepted
time: 20ms
memory: 10600kb
input:
66 24 2 11
output:
317970168
result:
ok 1 number(s): "317970168"
Test #131:
score: 0
Accepted
time: 22ms
memory: 10600kb
input:
66 26 1 0
output:
391681574
result:
ok 1 number(s): "391681574"
Test #132:
score: 0
Accepted
time: 22ms
memory: 10640kb
input:
66 26 2 00
output:
97862478
result:
ok 1 number(s): "97862478"
Test #133:
score: 0
Accepted
time: 19ms
memory: 10640kb
input:
66 28 1 0
output:
964005824
result:
ok 1 number(s): "964005824"
Test #134:
score: 0
Accepted
time: 23ms
memory: 10632kb
input:
66 28 2 11
output:
521812451
result:
ok 1 number(s): "521812451"
Test #135:
score: 0
Accepted
time: 15ms
memory: 10600kb
input:
57 24 10 0111100111
output:
275357201
result:
ok 1 number(s): "275357201"
Test #136:
score: 0
Accepted
time: 18ms
memory: 10896kb
input:
57 56 13 0111001000100
output:
712420784
result:
ok 1 number(s): "712420784"
Subtask #4:
score: 0
Time Limit Exceeded
Test #137:
score: 20
Accepted
time: 1820ms
memory: 10896kb
input:
114 20 0
output:
849724285
result:
ok 1 number(s): "849724285"
Test #138:
score: 0
Accepted
time: 1125ms
memory: 10596kb
input:
114 22 0
output:
918046462
result:
ok 1 number(s): "918046462"
Test #139:
score: 0
Accepted
time: 442ms
memory: 10696kb
input:
114 24 0
output:
471169566
result:
ok 1 number(s): "471169566"
Test #140:
score: 0
Accepted
time: 390ms
memory: 10600kb
input:
114 26 0
output:
540055361
result:
ok 1 number(s): "540055361"
Test #141:
score: 0
Accepted
time: 173ms
memory: 10884kb
input:
114 28 0
output:
997530597
result:
ok 1 number(s): "997530597"
Test #142:
score: 0
Accepted
time: 107ms
memory: 10896kb
input:
114 30 0
output:
37439521
result:
ok 1 number(s): "37439521"
Test #143:
score: 0
Accepted
time: 109ms
memory: 10628kb
input:
114 32 0
output:
448438493
result:
ok 1 number(s): "448438493"
Test #144:
score: 0
Accepted
time: 1729ms
memory: 10880kb
input:
113 20 0
output:
942733157
result:
ok 1 number(s): "942733157"
Test #145:
score: 0
Accepted
time: 917ms
memory: 10600kb
input:
113 22 0
output:
547536565
result:
ok 1 number(s): "547536565"
Test #146:
score: 0
Accepted
time: 422ms
memory: 10856kb
input:
113 24 0
output:
219952878
result:
ok 1 number(s): "219952878"
Test #147:
score: 0
Accepted
time: 362ms
memory: 10604kb
input:
113 26 0
output:
763274765
result:
ok 1 number(s): "763274765"
Test #148:
score: 0
Accepted
time: 132ms
memory: 10604kb
input:
113 28 0
output:
910952876
result:
ok 1 number(s): "910952876"
Test #149:
score: 0
Accepted
time: 100ms
memory: 10604kb
input:
113 30 0
output:
968408969
result:
ok 1 number(s): "968408969"
Test #150:
score: 0
Accepted
time: 110ms
memory: 10884kb
input:
113 32 0
output:
118567934
result:
ok 1 number(s): "118567934"
Test #151:
score: 0
Accepted
time: 1635ms
memory: 10684kb
input:
112 20 0
output:
275087743
result:
ok 1 number(s): "275087743"
Test #152:
score: 0
Accepted
time: 716ms
memory: 10616kb
input:
112 22 0
output:
185644824
result:
ok 1 number(s): "185644824"
Test #153:
score: 0
Accepted
time: 407ms
memory: 10848kb
input:
112 24 0
output:
557785519
result:
ok 1 number(s): "557785519"
Test #154:
score: 0
Accepted
time: 322ms
memory: 10852kb
input:
112 26 0
output:
522996775
result:
ok 1 number(s): "522996775"
Test #155:
score: 0
Accepted
time: 85ms
memory: 10884kb
input:
112 28 0
output:
134122652
result:
ok 1 number(s): "134122652"
Test #156:
score: 0
Accepted
time: 99ms
memory: 10596kb
input:
112 30 0
output:
502459554
result:
ok 1 number(s): "502459554"
Test #157:
score: 0
Accepted
time: 107ms
memory: 10628kb
input:
112 32 0
output:
169309797
result:
ok 1 number(s): "169309797"
Test #158:
score: 0
Accepted
time: 1538ms
memory: 10880kb
input:
111 20 0
output:
360310827
result:
ok 1 number(s): "360310827"
Test #159:
score: 0
Accepted
time: 506ms
memory: 10628kb
input:
111 22 0
output:
516490684
result:
ok 1 number(s): "516490684"
Test #160:
score: 0
Accepted
time: 394ms
memory: 10892kb
input:
111 24 0
output:
501679698
result:
ok 1 number(s): "501679698"
Test #161:
score: 0
Accepted
time: 298ms
memory: 10856kb
input:
111 26 0
output:
43788136
result:
ok 1 number(s): "43788136"
Test #162:
score: 0
Accepted
time: 88ms
memory: 10628kb
input:
111 28 0
output:
5764962
result:
ok 1 number(s): "5764962"
Test #163:
score: 0
Accepted
time: 100ms
memory: 10604kb
input:
111 30 0
output:
918617250
result:
ok 1 number(s): "918617250"
Test #164:
score: 0
Accepted
time: 103ms
memory: 10624kb
input:
111 32 0
output:
982496307
result:
ok 1 number(s): "982496307"
Test #165:
score: 0
Accepted
time: 27ms
memory: 10600kb
input:
114 114 0
output:
321821768
result:
ok 1 number(s): "321821768"
Test #166:
score: 0
Accepted
time: 58ms
memory: 10536kb
input:
114 50 0
output:
860957763
result:
ok 1 number(s): "860957763"
Test #167:
score: 0
Accepted
time: 52ms
memory: 10600kb
input:
113 50 0
output:
307614098
result:
ok 1 number(s): "307614098"
Test #168:
score: -20
Time Limit Exceeded
input:
110 10 0
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #2:
0%