QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#722907#9583. 飞沙走蛇TheZoneAC ✓613ms9344kbC++2023.6kb2024-11-07 20:34:152024-11-07 20:34:15

Judging History

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

  • [2024-11-07 20:34:15]
  • 评测
  • 测评结果:AC
  • 用时:613ms
  • 内存:9344kb
  • [2024-11-07 20:34:15]
  • 提交

answer

#pragma GCC optimize(2, 3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
//#define int long long
//#define double long double
using i64 = long long;
using ui64 = unsigned long long;
#define inf (int)0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define yn(x) cout << (x ? "yes" : "no") << endl
#define Yn(x) cout << (x ? "Yes" : "No") << endl
#define YN(x) cout << (x ? "YES" : "NO") << endl
#define mem(x, i) memset(x, i, sizeof(x))
#define cinarr(a, n) for (int _ = 1; _ <= n; _++) cin >> a[_]
#define cinstl(a) for (auto& _ : a) cin >> _
#define coutarr(a, n) for (int _ = 1; _ <= n; _++) cout << a[_] << " \n"[_ == n]
#define coutstl(a) for (const auto& _ : a) cout << _ << ' '; cout << endl
#define all(x) (x).begin(), (x).end()
#define ls (s << 1)
#define rs (s << 1 | 1)
#define ft first
#define se second
#define pii pair<int, int>
#ifdef DEBUG
    #include "debug.h"
#else
    #define dbg(...) void(0)
#endif

const int N = 2e5 + 5;
//const int M = 1e5 + 5;
const int mod = 998244353;
//const int mod = 1e9 + 7;
template <typename T> T ksm(T a, i64 b) { T ans = 1; for (; b; a = 1ll * a * a, b >>= 1) if (b & 1) ans = 1ll * ans * a; return ans; }
template <typename T> T ksm(T a, i64 b, T m) { T ans = 1; for (; b; a = 1ll * a * a % m, b >>= 1) if (b & 1) ans = 1ll * ans * a % m; return ans; }

int a[N];
int n, m, t, k, q, r;

template <int P> struct MInt {
    int x;
    MInt() : x(0) {}
    MInt(const signed& x) : x(norm(x % getMod())) {}
    MInt(const long long& x) : x(norm(x % getMod())) {}

    static int Mod;
    static int getMod() { return P > 0 ? P : Mod; }
    static void setMod(int _Mod) { Mod = _Mod; }
    int norm(const int& x) const { return x < 0 ? x + getMod() : (x >= getMod() ? x - getMod() : x); }
    int val() const { return x; }
    explicit operator int() const { return x; }
    MInt operator - () const { MInt res; res.x = norm(getMod() - x); return res; }
    MInt ksm(const long long& x) const {
        MInt a = *this, ans = 1;
        for (long long pw = x; pw; a *= a, pw >>= 1) if (pw & 1) ans *= a;
        return ans;
    }
    MInt inv() const { assert(x != 0); return ksm(getMod() - 2); }
    MInt& operator += (const MInt& b) & { x = norm(x + b.x); return *this; }
    MInt& operator -= (const MInt& b) & { x = norm(x - b.x); return *this; }
    MInt& operator *= (const MInt& b) & { x = norm(1ll * x * b.x % getMod()); return *this; }
    MInt& operator /= (const MInt& b) & { return *this *= b.inv(); }
    MInt& operator ++ () & { return *this += 1; }
    MInt& operator -- () & { return *this -= 1; }
    const MInt operator ++ (signed) { MInt old = *this; ++(*this); return old; }
    const MInt operator -- (signed) { MInt old = *this; --(*this); return old; }
    friend MInt operator + (const MInt& a, const MInt& b) { MInt res = a; res += b; return res; }
    friend MInt operator - (const MInt& a, const MInt& b) { MInt res = a; res -= b; return res; }
    friend MInt operator * (const MInt& a, const MInt& b) { MInt res = a; res *= b; return res; }
    friend MInt operator / (const MInt& a, const MInt& b) { MInt res = a; res /= b; return res; }
    friend istream& operator >> (istream& in, MInt& a) { long long v; in >> v; a = MInt(v); return in; }
    friend ostream& operator << (ostream& out, const MInt& a) { return out << a.val(); }
    friend bool operator == (const MInt& a, const MInt& b) { return a.val() == b.val(); }
    friend bool operator != (const MInt& a, const MInt& b) { return a.val() != b.val(); }
    friend bool operator < (const MInt& a, const MInt& b) { return a.val() < b.val(); }
    friend bool operator > (const MInt& a, const MInt& b) { return a.val() > b.val(); }
    friend bool operator <= (const MInt& a, const MInt& b) { return a.val() <= b.val(); }
    friend bool operator >= (const MInt& a, const MInt& b) { return a.val() >= b.val(); }
};
using Mint = MInt<mod>;
template<> int MInt<0>::Mod = 1;

template <typename T = int> struct Matrix {
    int m, n; // m 行 n 列的矩阵
    vector<vector<T>> v;

    Matrix(): n(0), m(0) { v.resize(0); }
    Matrix(int r, int c, T num = T()) : m(r), n(c) {
        v.resize(m + 1, vector<T>(n + 1, num));
    }
    Matrix(int n) : m(n), n(n) { // 单位矩阵的构造函数
        v.resize(n + 1, vector<T>(n + 1, 0));
        for (int i = 1; i <= n; i++) v[i][i] = 1;
    }

    Matrix& operator += (const Matrix& b) & {
        assert(m == b.m && n == b.n);
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                v[i][j] += b[i][j];
        return *this;
    }
    Matrix& operator -= (const Matrix& b) & {
        assert(m == b.m && n == b.n);
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                v[i][j] -= b[i][j];
        return *this;
    }
    Matrix& operator *= (const T& b) & {
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= n; j++)
                v[i][j] *= b;
        return *this;
    }
    Matrix& operator *= (const Matrix& b) & {
        assert(n == b.m);
        Matrix ans(m, b.n);
        for (int i = 1; i <= m; i++)
            for (int j = 1; j <= b.n; j++)
                for (int k = 1; k <= n; k++)
                    ans[i][j] += v[i][k] * b[k][j];
        return *this = ans;
    }
    friend Matrix operator + (const Matrix& a, const Matrix& b) {
        Matrix ans = a; ans += b; return ans;
    }
    friend Matrix operator - (const Matrix& a, const Matrix& b) {
        Matrix ans = a; ans -= b; return ans;
    }
    friend Matrix operator * (const Matrix& a, const T& b) {
        Matrix ans = a; a *= b; return ans;
    }
    friend Matrix operator * (const Matrix& a, const Matrix& b) {
        Matrix ans = a; ans *= b; return ans;
    }
    Matrix trans() const {
        Matrix ans(n, m);
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= m; j++)
                ans[i][j] = v[j][i];
        return ans;
    }
    Matrix ksm(const long long& x) const {
        assert(n == m);
        Matrix ans(n), a = *this;
        for (long long pw = x; pw; a *= a, pw >>= 1) if (pw & 1) ans *= a;
        return ans;
    }
    vector<T>& operator [] (const int& t) { return v[t]; }
    const vector<T>& operator [] (const int& t) const { return v[t]; }

    friend bool operator == (const Matrix& a, const Matrix& b) {
        assert(a.m == b.m && a.n == b.n);
        for (int i = 1; i <= a.m; i++)
            for (int j = 1; j <= a.n; j++)
                if (a[i][j] != b[i][j])
                    return false;
        return true;
    }
    friend bool operator != (const Matrix& a, const Matrix& b) {
        return !(a == b);
    }

    friend istream& operator >> (istream& in, Matrix& x) {
        in >> x.m >> x.n;
        x.v.resize(x.m + 1, vector<T>(x.n + 1, 0));
        for (int i = 1; i <= x.m; i++)
            for (int j = 1; j <= x.n; j++)
                in >> x[i][j];
        return in;
    }
    friend ostream& operator << (ostream& out, const Matrix& x) {
        for (int i = 1; i <= x.m; i++)
            for (int j = 1; j <= x.n; j++)
                out << x[i][j] << " \n"[j == x.n];
        return out;
    }
};

template <typename T> T del(int n, Matrix<T> a) {
    T ans = 1, sgn = 1;
    for (int i = 1; i <= n; i++) {
        int t = i;
        for (int j = i; j <= n; j++) if (a[j][i] != 0) { t = j; break; }
        if (a[t][i] == 0) return 0;
        if (t != i) swap(a[t], a[i]), sgn *= -1;
        for (int j = i + 1; j <= n; j++) {
            T div = a[j][i] / a[i][i];
            for (int k = i; k <= n; k++)
                a[j][k] = a[j][k] - div * a[i][k];
        }
        ans *= a[i][i];
    }
    return ans * sgn;
}

template<typename T> struct Comb {
    int n;
    vector<T> _fac, _infac, _inv;
    Comb() : n(0), _fac{1}, _infac{1}, _inv{0} {}
    Comb(int n) : Comb() { init(n); }

    void init(int m) {
        if (m <= n) return;
        _fac.resize(m + 1), _infac.resize(m + 1), _inv.resize(m + 1);
        for (int i = n + 1; i <= m; i++)
            _fac[i] = _fac[i - 1] * i;
        _infac[m] = 1 / _fac[m];
        for (int i = m; i > n; i--) {
            _infac[i - 1] = _infac[i] * i;
            _inv[i] = _infac[i] * _fac[i - 1];
        }
        n = m;
    }
    T fac(int m) { if (m > n) init(2 * m); return _fac[m]; }
    T infac(int m) { if (m > n) init(2 * m); return _infac[m]; }
    T inv(int m) { if (m > n) init(2 * m); return _inv[m]; }
    T a(int n, int m) { return n < m || m < 0 ? 0 : fac(n) * infac(n - m); }
    T c(int n, int m) { return n < m || m < 0 ? 0 : fac(n) * infac(n - m) * infac(m); }
};
Comb<Mint> comb;

void work() {
    cin >> n >> r; r--;

    Matrix<Mint> A(n, n), Din(n, n), Dout(n, n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> A[i][j];
            if (A[i][j] == 1) {
                Dout[i][i] += 1;
                Din[j][j] += 1;
            }
        }
    }
    Matrix Lin = Din - A, Lout = Dout - A;
    k = int(Din[1][1]);

    Mint tleaf = del(n - 1, Lin);
    Mint troot = del(n - 1, Lout);
    assert(tleaf == troot);

    // T(D)
    Mint t = troot * n;

    // T(L^r(D))=k^{nk^r-n}T(D)
    Mint T = Mint(k).ksm(n).ksm(ksm(k, r, mod - 1) - 1) * t;

    // use E(D)=K(D)[(k-1)!]^n to calculate E(L^r(D))
    Mint E1 = T / (n * Mint(k).ksm(r)) * comb.fac(k - 1).ksm(n).ksm(ksm(k, r, mod - 1));

    // E(L^r(D))=\frac{(k!)^{nk^r}}/{nk^{r+n}}T(D)
    Mint E2 = comb.fac(k).ksm(n).ksm(ksm(k, r, mod - 1)) / (n * Mint(k).ksm(r + n)) * t;
    assert(E1 == E2);
    cout << E1 * n * Mint(k).ksm(r + 1) << endl;
}

signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\admin\\CLionProjects\\Practice\\data.in", "r", stdin);
    freopen("C:\\Users\\admin\\CLionProjects\\Practice\\data.out", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int Case = 1;
    //cin >> Case;
    while (Case--) work();
    return 0;
}





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































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

詳細信息

Test #1:

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

input:

4 2
0 1 1 0
1 0 0 1
0 1 0 1
1 0 1 0

output:

640

result:

ok single line: '640'

Test #2:

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

input:

6 5
0 0 0 1 1 1
1 0 1 1 0 0
0 1 0 0 1 1
1 1 0 0 1 0
0 1 1 0 0 1
1 0 1 1 0 0

output:

495839213

result:

ok single line: '495839213'

Test #3:

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

input:

2 2
0 1
1 0

output:

2

result:

ok single line: '2'

Test #4:

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

input:

2 3
0 1
1 0

output:

2

result:

ok single line: '2'

Test #5:

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

input:

3 1
0 1 1
1 0 1
1 1 0

output:

18

result:

ok single line: '18'

Test #6:

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

input:

3 2
0 1 1
1 0 1
1 1 0

output:

144

result:

ok single line: '144'

Test #7:

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

input:

3 1000000000
0 1 1
1 0 1
1 1 0

output:

648855879

result:

ok single line: '648855879'

Test #8:

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

input:

3 3
0 0 1
1 0 0
0 1 0

output:

3

result:

ok single line: '3'

Test #9:

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

input:

3 1
0 0 1
1 0 0
0 1 0

output:

3

result:

ok single line: '3'

Test #10:

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

input:

3 2
0 0 1
1 0 0
0 1 0

output:

3

result:

ok single line: '3'

Test #11:

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

input:

3 1000000000
0 0 1
1 0 0
0 1 0

output:

3

result:

ok single line: '3'

Test #12:

score: 0
Accepted
time: 202ms
memory: 9156kb

input:

500 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

500

result:

ok single line: '500'

Test #13:

score: 0
Accepted
time: 198ms
memory: 9212kb

input:

500 13231455
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

500

result:

ok single line: '500'

Test #14:

score: 0
Accepted
time: 202ms
memory: 9328kb

input:

500 1000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

500

result:

ok single line: '500'

Test #15:

score: 0
Accepted
time: 214ms
memory: 9164kb

input:

500 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

929904581

result:

ok single line: '929904581'

Test #16:

score: 0
Accepted
time: 215ms
memory: 9132kb

input:

500 3473
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

175908529

result:

ok single line: '175908529'

Test #17:

score: 0
Accepted
time: 209ms
memory: 9204kb

input:

500 7259683
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

655684619

result:

ok single line: '655684619'

Test #18:

score: 0
Accepted
time: 211ms
memory: 9276kb

input:

500 230946703
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

568045861

result:

ok single line: '568045861'

Test #19:

score: 0
Accepted
time: 209ms
memory: 9212kb

input:

500 1000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

460701981

result:

ok single line: '460701981'

Test #20:

score: 0
Accepted
time: 189ms
memory: 9344kb

input:

500 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

944360131

result:

ok single line: '944360131'

Test #21:

score: 0
Accepted
time: 193ms
memory: 9212kb

input:

500 9007345
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

969216847

result:

ok single line: '969216847'

Test #22:

score: 0
Accepted
time: 193ms
memory: 9324kb

input:

500 1000000000
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

609879631

result:

ok single line: '609879631'

Test #23:

score: 0
Accepted
time: 185ms
memory: 9328kb

input:

500 1
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

360908447

result:

ok single line: '360908447'

Test #24:

score: 0
Accepted
time: 191ms
memory: 9280kb

input:

500 84739457
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

155982074

result:

ok single line: '155982074'

Test #25:

score: 0
Accepted
time: 191ms
memory: 9140kb

input:

500 1000000000
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

390658316

result:

ok single line: '390658316'

Test #26:

score: 0
Accepted
time: 292ms
memory: 7148kb

input:

401 674350985
0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ...

output:

231415258

result:

ok single line: '231415258'

Test #27:

score: 0
Accepted
time: 285ms
memory: 6772kb

input:

391 713960239
0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 ...

output:

893037277

result:

ok single line: '893037277'

Test #28:

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

input:

38 160856383
0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1
0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0...

output:

723071717

result:

ok single line: '723071717'

Test #29:

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

input:

73 124976767
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0...

output:

174117828

result:

ok single line: '174117828'

Test #30:

score: 0
Accepted
time: 32ms
memory: 4396kb

input:

182 698060591
0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 ...

output:

59743995

result:

ok single line: '59743995'

Test #31:

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

input:

100 610380569
0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ...

output:

492075005

result:

ok single line: '492075005'

Test #32:

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

input:

150 314483306
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

278849507

result:

ok single line: '278849507'

Test #33:

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

input:

176 244584016
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

344919233

result:

ok single line: '344919233'

Test #34:

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

input:

64 520840604
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

823871833

result:

ok single line: '823871833'

Test #35:

score: 0
Accepted
time: 347ms
memory: 7872kb

input:

437 98584036
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

991705694

result:

ok single line: '991705694'

Test #36:

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

input:

28 62704420
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 ...

output:

325247558

result:

ok single line: '325247558'

Test #37:

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

input:

67 305871307
0 1 0 0 0 1 0 0 1 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0
1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0
0 1 0 0 0 1 1 1 0 1...

output:

188107088

result:

ok single line: '188107088'

Test #38:

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

input:

162 639517882
0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 ...

output:

323223967

result:

ok single line: '323223967'

Test #39:

score: 0
Accepted
time: 398ms
memory: 8044kb

input:

448 128651320
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 ...

output:

209555963

result:

ok single line: '209555963'

Test #40:

score: 0
Accepted
time: 365ms
memory: 7812kb

input:

443 464157838
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ...

output:

397751218

result:

ok single line: '397751218'

Test #41:

score: 0
Accepted
time: 495ms
memory: 8900kb

input:

484 724175485
0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

550992763

result:

ok single line: '550992763'

Test #42:

score: 0
Accepted
time: 218ms
memory: 8732kb

input:

479 428278222
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

558639642

result:

ok single line: '558639642'

Test #43:

score: 0
Accepted
time: 237ms
memory: 6584kb

input:

362 671445108
0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 1 0 0 1 1 0 0 0 0 1 1 0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 ...

output:

679626502

result:

ok single line: '679626502'

Test #44:

score: 0
Accepted
time: 341ms
memory: 7280kb

input:

412 670515137
0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 ...

output:

354533888

result:

ok single line: '354533888'

Test #45:

score: 0
Accepted
time: 365ms
memory: 8032kb

input:

447 339668229
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

781030556

result:

ok single line: '781030556'

Test #46:

score: 0
Accepted
time: 570ms
memory: 9140kb

input:

500 624251153
0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

647304783

result:

ok single line: '647304783'

Test #47:

score: 0
Accepted
time: 610ms
memory: 9144kb

input:

500 183373765
0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 1 ...

output:

786242432

result:

ok single line: '786242432'

Test #48:

score: 0
Accepted
time: 612ms
memory: 9280kb

input:

500 665677152
0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 0 1 1 ...

output:

260396338

result:

ok single line: '260396338'

Test #49:

score: 0
Accepted
time: 613ms
memory: 9092kb

input:

500 453780695
0 1 1 1 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0 0 1 1 0 0 1 1 0 ...

output:

793585863

result:

ok single line: '793585863'

Test #50:

score: 0
Accepted
time: 600ms
memory: 9124kb

input:

500 412922856
0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 ...

output:

486242003

result:

ok single line: '486242003'

Test #51:

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

input:

68 174614752
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0...

output:

987924144

result:

ok single line: '987924144'

Test #52:

score: 0
Accepted
time: 524ms
memory: 8568kb

input:

474 668812416
0 1 1 1 1 0 0 1 0 0 1 0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 0 ...

output:

65477353

result:

ok single line: '65477353'

Test #53:

score: 0
Accepted
time: 41ms
memory: 4540kb

input:

198 231731353
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 ...

output:

503601382

result:

ok single line: '503601382'

Test #54:

score: 0
Accepted
time: 592ms
memory: 9140kb

input:

498 733013155
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 ...

output:

526147259

result:

ok single line: '526147259'

Test #55:

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

input:

50 939472590
0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0
0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0...

output:

45695576

result:

ok single line: '45695576'

Test #56:

score: 0
Accepted
time: 314ms
memory: 7172kb

input:

406 390786012
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 ...

output:

760157075

result:

ok single line: '760157075'

Test #57:

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

input:

106 486123436
0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 0 1
1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 1 1 1 ...

output:

427211541

result:

ok single line: '427211541'

Test #58:

score: 0
Accepted
time: 370ms
memory: 7620kb

input:

421 904131720
0 1 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 0 1 0 1 1 1 1 0 1 0 ...

output:

443056316

result:

ok single line: '443056316'

Test #59:

score: 0
Accepted
time: 190ms
memory: 5940kb

input:

334 270643942
0 1 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 0 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 0 1 0 0 1 0 0 1 ...

output:

588349154

result:

ok single line: '588349154'

Test #60:

score: 0
Accepted
time: 13ms
memory: 4148kb

input:

152 708414169
0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

676451844

result:

ok single line: '676451844'

Test #61:

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

input:

2 1
0 1
1 0

output:

2

result:

ok single line: '2'

Extra Test:

score: 0
Extra Test Passed