QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738356#9438. Two BoxMax_s_xaMAC ✓1637ms514460kbC++175.2kb2024-11-12 18:48:502024-11-12 18:48:52

Judging History

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

  • [2024-11-12 18:48:52]
  • 评测
  • 测评结果:AC
  • 用时:1637ms
  • 内存:514460kb
  • [2024-11-12 18:48:50]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <random>
#include <ctime>
#include <chrono>
#include <numeric>
#include <iomanip>
#include <cassert>

typedef long long ll;
typedef double lf;

// #define DEBUG 1
struct IO
{
    #define MAXSIZE (1 << 20)
    #define isdigit(x) (x >= '0' && x <= '9')
    char buf[MAXSIZE], *p1, *p2;
    char pbuf[MAXSIZE], *pp;
    #if DEBUG
    #else
    IO() : p1(buf), p2(buf), pp(pbuf) {}
    ~IO() {fwrite(pbuf, 1, pp - pbuf, stdout);}
    #endif
    #define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ? ' ' : *p1++)
    #define blank(x) (x == ' ' || x == '\n' || x == '\r' || x == '\t')

    template <typename T>
    void Read(T &x)
    {
        #if DEBUG
        std::cin >> x;
        #else
        bool sign = 0; char ch = gc(); x = 0;
        for (; !isdigit(ch); ch = gc())
            if (ch == '-') sign = 1;
        for (; isdigit(ch); ch = gc()) x = x * 10 + (ch ^ 48);
        if (sign) x = -x;
        #endif
    }
    void Read(char *s)
    {
        #if DEBUG
        std::cin >> s;
        #else
        char ch = gc();
        for (; blank(ch); ch = gc());
        for (; !blank(ch); ch = gc()) *s++ = ch;
        *s = 0;
        #endif
    }
    void Read(char &c) {for (c = gc(); blank(c); c = gc());}

    void Push(const char &c)
    {
        #if DEBUG
        putchar(c);
        #else
        if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
        *pp++ = c;
        #endif
    }
    template <typename T>
    void Write(T x)
    {
        if (x < 0) x = -x, Push('-');
        static T sta[35];
        int top = 0;
        do sta[top++] = x % 10, x /= 10; while (x);
        while (top) Push(sta[--top] ^ 48);
    }
    template <typename T>
    void Write(T x, char lst) {Write(x), Push(lst);}
} IO;
#define Read(x) IO.Read(x)
#define Write(x, y) IO.Write(x, y)
#define Put(x) IO.Push(x)

using namespace std;

const int MAXN = 3e4 + 10, MAXM = 32, mod = 998244353, inv2 = (mod + 1) / 2;

int n, m, q;
int a[MAXN];

int pw[MAXM][MAXN];

struct Node
{
    int v[MAXM], sz;
    Node() { for (int i = 0; i <= 30; i++) v[i] = 1; sz = 0; }
    Node operator + (const Node &u) const
    {
        Node c;
        for (int i = 0; i <= 2 * m; i++) c.v[i] = (ll)v[i] * u.v[i] % mod;
        c.sz = sz + u.sz;
        return c;
    }
    void Mul(int k)
    {
        for (int i = 0; i <= 2 * m; i++) v[i] = (ll)v[i] * pw[i][k] % mod;
        sz += k;
    }
    void Calc(bool tp)
    {
        if (tp)
            for (int i = 0; i < 2 * m; i++) v[i] = v[i + 1];
        else
        {
            static int tmp[MAXM];
            for (int i = 1; i < 2 * m; i++) tmp[i] = (ll)(v[i - 1] + v[i + 1]) * inv2 % mod;
            for (int i = 1; i < 2 * m; i++) v[i] = tmp[i];
        }
    }
};

struct Seg
{
    Node tr[MAXN << 2];
    #define ls (p << 1)
    #define rs (p << 1 | 1)
    inline void Pushup(int p) { tr[p] = tr[ls] + tr[rs]; }
    void Update(int x, Node k, int p = 1, int l = 1, int r = n)
    {
        if (l == r) return tr[p] = k, void();
        int mid = l + r >> 1;
        if (x <= mid) Update(x, k, ls, l, mid);
        else Update(x, k, rs, mid + 1, r);
        Pushup(p);
    }
    Node Query(int x, int y, int p = 1, int l = 1, int r = n)
    {
        if (x <= l && r <= y) return tr[p];
        int mid = l + r >> 1; Node ans;
        if (x <= mid) ans = ans + Query(x, y, ls, l, mid);
        if (y > mid) ans = ans + Query(x, y, rs, mid + 1, r);
        return ans;
    }
};

Seg t[MAXM];
set <int> pl[MAXM];

inline void Solve(int u, int i)
{
    if (i > a[u] || i <= a[u - 1]) return;
    int pos = *prev(pl[i].lower_bound(u)) + 1;
    Node cur;
    if (i > 1) cur = t[i - 1].Query(pos, u);
    int len = u - pos + (u < n);
    cur.Mul(len - cur.sz), cur.Calc(u == n);
    t[i].Update(u, cur);
}

int main()
{
    #if DEBUG
    #else
    ios::sync_with_stdio(0), cin.tie(0);
    #endif
    Read(n), Read(m), Read(q);
    for (int i = 1; i <= n; i++) Read(a[i]), a[i] = m - a[i];

    n++;
    for (int i = 0; i <= 2 * m; i++)
    {
        pw[i][0] = 1, pw[i][1] = (i - m + mod) % mod;
        for (int j = 2; j <= n; j++) pw[i][j] = (ll)pw[i][j - 1] * pw[i][1] % mod;
    }

    a[0] = a[n] = m;
    for (int i = 0; i <= n; i++)
        for (int j = 1; j <= a[i]; j++) pl[j].insert(i);
    
    for (int i = 2; i <= n; i++)
        for (int j = a[i - 1] + 1; j <= a[i]; j++)
            Solve(i, j);

    int u, x;
    while (q--)
    {
        Read(u), Read(x), x = m - x;
        while (a[u] < x)
        {
            a[u]++, pl[a[u]].insert(u);
            Solve(u, a[u]);
            int pos = *pl[a[u]].upper_bound(u);
            if (pos == u + 1) t[a[u]].Update(pos, Node());
            else Solve(pos, a[u]);
        }
        while (a[u] > x) t[a[u]].Update(u, Node()), pl[a[u]].erase(u), a[u]--;
        for (int i = x + 1; i <= m; i++)
        {
            u = *pl[i].lower_bound(u);
            Solve(u, i);
        }
        cout << t[m].tr[1].v[m] << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 28ms
memory: 498824kb

input:

3 3 2
1 3 1
3 2
1 3

output:

5
14

result:

ok 2 tokens

Test #2:

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

input:

6 8 1
3 8 7 7 1 6
1 4

output:

2100

result:

ok "2100"

Test #3:

score: 0
Accepted
time: 40ms
memory: 500924kb

input:

12 10 8
1 3 2 6 3 6 7 7 5 5 4 7
12 4
7 10
4 2
9 8
9 9
8 3
4 9
10 2

output:

2741280
3007680
1503840
1916160
1972800
728640
1821600
621440

result:

ok 8 tokens

Test #4:

score: 0
Accepted
time: 43ms
memory: 501140kb

input:

1939 5 1
5 1 1 2 1 5 4 5 3 1 2 1 3 3 1 2 3 5 5 3 2 2 1 3 1 5 1 4 2 5 4 1 5 4 3 4 5 3 3 3 3 2 1 2 3 5 1 4 2 1 4 1 3 5 2 2 1 4 4 5 3 2 3 2 1 1 5 5 5 5 3 4 3 1 3 1 1 1 3 5 3 5 1 5 4 3 2 1 2 2 2 3 5 2 4 2 3 1 2 5 5 1 2 5 2 5 3 3 3 4 5 1 5 4 5 3 3 5 4 5 3 5 3 2 2 5 3 2 4 3 3 4 2 2 1 3 1 3 5 2 3 4 2 3 2 4...

output:

894246250

result:

ok "894246250"

Test #5:

score: 0
Accepted
time: 40ms
memory: 498980kb

input:

245 9 1
2 2 3 6 7 5 7 4 7 9 7 6 3 1 6 8 2 1 1 5 3 1 1 3 1 6 8 4 8 4 8 1 8 6 6 9 3 4 7 1 5 2 3 9 5 7 5 7 7 5 5 5 5 1 5 4 7 1 2 6 8 9 5 4 1 8 6 3 9 9 1 3 6 5 5 5 1 6 5 1 2 5 5 4 1 1 8 3 8 2 9 7 9 5 7 8 8 5 9 1 1 4 4 9 9 6 3 9 8 9 2 1 2 6 9 2 1 3 7 3 2 5 9 3 7 2 2 3 4 7 5 1 8 5 8 6 7 9 7 4 8 7 2 2 7 5 ...

output:

99945033

result:

ok "99945033"

Test #6:

score: 0
Accepted
time: 39ms
memory: 499504kb

input:

1919 9 1
7 1 7 6 6 9 8 5 1 8 9 9 7 3 4 2 8 9 4 8 7 4 8 8 8 4 2 9 5 9 3 7 2 3 2 8 7 9 1 1 3 7 7 2 5 9 2 1 3 6 7 6 4 4 1 9 3 7 3 2 5 5 1 4 7 8 6 2 1 4 7 1 4 7 4 7 6 3 8 4 3 7 3 1 7 5 2 2 2 4 9 1 5 5 7 7 3 1 5 4 7 2 9 5 4 9 3 2 6 8 2 3 8 3 6 5 5 5 9 7 2 8 2 9 5 1 8 6 3 1 2 9 1 9 1 3 9 6 7 2 3 2 2 7 9 7...

output:

292474819

result:

ok "292474819"

Test #7:

score: 0
Accepted
time: 28ms
memory: 499192kb

input:

1985 5 1
1 5 5 1 4 4 3 2 1 4 4 1 1 2 5 5 5 3 3 1 2 4 3 3 5 5 2 4 1 1 5 4 3 1 2 5 5 4 1 5 2 5 2 4 1 4 5 1 3 4 4 2 2 4 5 2 1 5 5 3 2 5 5 2 4 4 5 2 5 1 1 5 5 1 1 3 4 2 4 5 2 1 2 1 1 2 3 5 1 5 2 4 1 5 3 2 2 3 1 3 4 5 1 4 4 2 4 3 5 5 1 4 3 4 5 5 2 5 2 2 2 2 2 3 5 1 4 4 3 3 4 5 5 4 3 5 1 4 5 5 2 3 2 2 3 3...

output:

810807913

result:

ok "810807913"

Test #8:

score: 0
Accepted
time: 59ms
memory: 498936kb

input:

357 5 1
1 3 2 5 4 4 3 4 3 1 1 1 4 5 5 2 1 3 4 1 3 1 2 3 4 1 5 3 1 3 5 1 4 4 2 4 5 1 3 4 2 5 2 3 2 5 3 2 2 1 4 3 1 1 2 3 2 3 2 1 4 4 5 5 1 4 2 1 2 2 2 4 1 3 5 1 1 2 4 4 5 4 1 2 4 1 2 3 2 4 3 4 3 4 1 4 1 1 4 5 4 4 4 3 2 5 4 5 4 2 4 1 2 5 5 3 5 5 2 4 2 1 2 1 4 1 2 1 3 1 5 2 2 1 5 2 2 4 5 1 3 4 5 3 3 3 ...

output:

836628563

result:

ok "836628563"

Test #9:

score: 0
Accepted
time: 24ms
memory: 499220kb

input:

858 10 1
1 9 2 9 6 9 6 10 9 4 1 9 7 7 9 2 5 6 9 3 4 7 4 2 5 10 8 10 4 8 8 1 2 9 10 9 5 9 1 2 1 8 10 2 8 1 10 6 9 5 2 4 9 4 1 5 6 10 7 5 1 7 6 7 9 8 4 4 1 8 1 4 4 10 8 10 1 1 1 2 6 3 6 9 8 10 4 5 8 3 6 7 2 9 9 7 9 10 5 7 4 9 4 7 3 1 10 2 6 4 1 5 8 7 1 6 1 2 8 8 1 3 6 8 5 3 10 9 8 4 8 5 2 2 2 10 8 1 8...

output:

699591879

result:

ok "699591879"

Test #10:

score: 0
Accepted
time: 35ms
memory: 501184kb

input:

884 7 1
7 2 6 7 1 7 2 5 5 1 7 5 4 5 2 5 4 2 2 4 3 2 7 1 6 3 3 2 1 1 2 1 7 7 4 3 5 1 1 6 6 7 5 1 6 6 4 3 5 2 3 1 6 3 7 2 7 4 6 6 6 3 7 6 1 3 2 1 1 5 4 3 1 4 4 4 7 2 5 7 5 7 5 3 6 5 5 1 4 5 6 6 6 3 6 7 3 2 3 1 5 5 6 7 6 5 3 2 7 3 1 2 5 5 1 2 7 5 3 1 3 6 4 7 2 4 4 5 6 7 4 7 4 2 4 1 2 1 2 6 7 1 7 4 1 1 ...

output:

298342150

result:

ok "298342150"

Test #11:

score: 0
Accepted
time: 44ms
memory: 501580kb

input:

2000 10 1
7 2 5 8 9 1 9 9 5 4 3 3 9 7 3 2 1 9 9 6 4 9 10 10 1 1 2 4 6 7 9 9 5 5 8 1 3 9 5 2 5 7 10 8 5 10 1 9 8 10 2 1 9 4 1 10 8 3 10 4 4 7 5 6 6 1 4 4 4 6 5 10 5 7 7 9 2 3 9 4 8 8 9 9 4 6 5 9 5 4 3 10 3 5 7 5 9 8 1 9 2 9 4 3 3 4 6 3 1 5 2 10 2 2 3 4 5 2 4 6 2 9 5 10 5 2 9 4 9 8 8 7 5 7 3 10 2 6 6 ...

output:

593281642

result:

ok "593281642"

Test #12:

score: 0
Accepted
time: 31ms
memory: 501564kb

input:

2000 10 1
4 3 9 2 9 3 9 2 7 1 4 10 1 10 8 10 1 6 9 5 7 5 10 10 1 10 5 7 1 5 5 8 10 10 4 10 6 6 1 9 8 5 2 3 5 3 1 1 3 3 6 2 6 9 8 4 10 8 7 8 9 10 5 3 6 3 2 4 10 1 10 8 7 10 7 1 4 3 2 8 8 7 7 9 1 7 5 3 5 7 6 6 9 8 8 8 9 7 10 8 3 5 5 1 3 10 9 1 9 2 10 9 3 1 6 1 7 10 9 9 9 3 6 9 2 10 6 1 5 2 2 5 6 6 9 1...

output:

635535966

result:

ok "635535966"

Test #13:

score: 0
Accepted
time: 39ms
memory: 499548kb

input:

2000 10 1
7 6 2 4 9 3 2 10 6 2 3 2 8 7 4 1 6 7 1 10 4 9 7 2 5 2 5 10 6 6 5 3 7 4 10 6 4 8 7 9 6 10 10 3 10 4 3 6 6 6 8 5 6 4 3 9 2 9 8 5 6 5 5 4 9 7 6 1 7 1 8 10 3 1 10 3 4 4 9 10 10 7 8 4 4 6 9 3 6 3 4 4 3 4 7 1 6 2 6 4 9 10 4 2 7 7 10 4 4 1 10 2 8 6 8 2 8 1 4 10 3 6 1 1 7 9 3 9 6 2 3 9 8 3 7 9 3 8...

output:

336713065

result:

ok "336713065"

Test #14:

score: 0
Accepted
time: 20ms
memory: 499556kb

input:

2000 10 1
10 10 2 4 8 7 8 9 8 7 5 10 8 2 5 5 1 3 10 5 4 3 6 3 9 9 10 9 9 9 6 10 6 2 9 3 7 4 7 10 2 4 7 3 9 3 7 10 5 9 10 7 8 1 7 7 9 10 6 4 10 4 3 6 10 5 4 7 5 6 8 8 1 6 5 7 7 5 4 2 5 8 5 9 9 9 7 10 2 9 7 6 1 8 9 2 4 1 9 8 7 9 4 2 3 2 3 2 7 5 4 8 8 2 4 8 6 4 1 3 3 9 7 10 7 7 3 8 1 1 4 2 3 4 10 8 8 8...

output:

85227947

result:

ok "85227947"

Test #15:

score: 0
Accepted
time: 48ms
memory: 501500kb

input:

2000 10 1
1 7 2 8 1 9 7 7 6 2 4 2 1 5 2 6 1 10 2 8 5 1 6 8 5 9 10 5 8 2 1 2 8 6 2 3 7 9 10 10 10 9 9 3 6 1 7 8 4 8 9 7 9 5 1 3 8 1 3 4 1 6 6 5 9 6 7 8 10 10 4 9 5 6 10 7 2 3 4 7 3 8 6 3 5 2 2 9 9 5 8 3 6 8 2 1 4 3 4 2 3 9 6 4 5 6 8 1 2 1 3 10 4 5 7 2 9 4 10 6 1 6 1 2 10 2 3 9 5 9 1 6 10 2 8 6 10 6 1...

output:

913697441

result:

ok "913697441"

Test #16:

score: 0
Accepted
time: 24ms
memory: 501540kb

input:

2000 10 1
7 9 2 6 9 1 10 1 8 3 4 5 1 10 6 10 4 10 3 1 10 2 10 8 3 5 2 2 4 9 5 7 2 4 8 5 7 5 1 10 8 10 5 8 10 4 2 9 8 9 6 3 7 10 1 7 6 9 4 10 8 5 1 3 5 7 3 6 3 2 8 5 6 2 8 2 7 6 1 6 7 4 3 5 8 3 8 9 5 6 2 8 2 4 5 2 4 1 3 9 7 1 5 9 9 2 3 2 1 8 6 1 3 6 7 3 5 5 8 3 9 5 9 1 7 2 3 5 1 7 8 10 3 4 10 8 3 6 8...

output:

298067446

result:

ok "298067446"

Test #17:

score: 0
Accepted
time: 51ms
memory: 501512kb

input:

2000 10 1
3 6 1 8 2 3 8 7 9 8 8 5 3 4 4 2 9 1 2 4 7 3 3 3 2 3 9 9 4 4 1 1 1 2 2 4 3 7 8 2 2 1 9 2 7 10 9 5 10 8 1 8 6 2 4 9 2 7 8 2 2 1 1 8 10 8 7 7 1 5 2 4 9 3 2 1 7 1 1 6 1 7 1 7 6 9 6 1 2 3 6 10 3 10 3 2 6 7 10 6 2 6 2 6 7 2 2 7 2 1 6 5 10 5 2 2 10 4 1 9 8 8 7 6 1 9 2 4 1 4 5 7 5 3 10 4 9 5 2 8 8...

output:

307824286

result:

ok "307824286"

Test #18:

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

input:

2000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1

result:

ok "1"

Test #19:

score: 0
Accepted
time: 44ms
memory: 498744kb

input:

1 1 1
1
1 1

output:

1

result:

ok "1"

Test #20:

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

input:

2000 10 1
9 10 10 10 10 9 10 9 9 10 10 9 9 10 9 10 10 10 10 10 10 9 9 10 10 9 10 10 9 10 9 10 10 10 10 9 10 10 9 10 10 10 9 10 9 10 9 9 9 10 9 10 9 10 10 9 9 10 10 9 10 10 10 10 10 9 9 10 9 10 10 9 9 10 9 9 10 9 10 10 9 9 9 10 9 10 10 9 10 10 9 9 10 10 10 10 9 10 10 10 9 9 9 10 10 9 9 10 9 10 10 10 ...

output:

214050412

result:

ok "214050412"

Test #21:

score: 0
Accepted
time: 40ms
memory: 499056kb

input:

2000 10 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10...

output:

527357103

result:

ok "527357103"

Test #22:

score: 0
Accepted
time: 31ms
memory: 501148kb

input:

2000 10 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10...

output:

106236082

result:

ok "106236082"

Test #23:

score: 0
Accepted
time: 44ms
memory: 501332kb

input:

5484 3 1
1 3 1 3 3 1 1 2 3 1 3 3 3 3 3 2 2 3 1 3 3 2 1 3 3 1 2 2 2 3 2 2 3 2 3 2 1 2 1 1 1 1 2 2 3 1 1 3 3 1 3 1 1 2 2 2 3 1 3 1 3 2 1 3 1 3 2 1 3 1 1 1 3 1 3 1 2 2 1 2 2 1 3 3 3 2 3 1 2 1 1 3 1 1 1 2 2 1 3 2 3 2 3 1 3 2 2 2 3 1 3 2 2 2 3 2 3 1 2 3 1 1 1 3 3 3 2 3 3 3 3 2 2 1 3 1 1 1 2 1 2 2 1 1 2 3...

output:

886224409

result:

ok "886224409"

Test #24:

score: 0
Accepted
time: 64ms
memory: 502076kb

input:

8556 12 1
10 4 12 5 11 12 11 6 10 7 3 10 4 1 6 3 5 4 6 3 10 12 10 6 9 9 1 9 11 6 12 11 5 8 3 1 11 12 7 1 4 6 3 6 8 8 12 8 9 3 8 7 2 2 5 5 4 1 9 8 7 3 1 5 9 10 5 6 10 6 7 6 10 1 10 2 4 9 12 6 2 6 7 8 9 7 3 12 6 5 12 5 9 3 5 3 7 7 8 6 11 10 8 10 4 3 5 2 7 3 5 7 8 6 2 2 11 12 4 12 10 10 10 6 4 5 1 7 6 ...

output:

835287489

result:

ok "835287489"

Test #25:

score: 0
Accepted
time: 175ms
memory: 513252kb

input:

29076 14 1
14 12 7 10 5 11 7 12 1 14 2 7 12 1 14 13 9 10 13 1 14 2 10 11 5 4 8 13 8 1 5 9 5 10 1 4 9 13 10 9 12 6 7 2 14 13 11 3 6 6 4 6 11 1 2 12 6 1 12 1 3 8 6 6 3 11 4 10 2 10 11 2 5 11 13 14 12 11 2 9 4 12 3 4 2 2 14 2 10 8 11 4 5 11 2 7 11 1 9 13 2 2 12 10 5 4 5 4 4 9 9 2 7 13 12 2 14 6 12 3 4 ...

output:

428714926

result:

ok "428714926"

Test #26:

score: 0
Accepted
time: 84ms
memory: 505856kb

input:

21530 8 1
5 1 1 7 2 2 4 1 1 6 3 3 4 8 1 8 3 8 6 6 2 6 7 4 8 8 4 5 2 1 4 2 4 7 7 8 7 1 5 1 1 2 8 3 4 3 8 1 4 4 4 2 5 3 3 3 8 1 5 7 8 7 6 1 6 4 3 7 7 4 6 8 3 1 2 8 1 6 1 6 6 1 1 4 7 1 4 5 4 1 4 7 1 6 2 6 6 2 1 6 1 4 3 1 7 4 4 6 8 3 8 8 8 4 2 2 3 5 3 3 7 8 4 6 3 1 4 7 7 2 5 1 4 5 2 7 7 7 4 1 5 6 5 6 8 ...

output:

682167889

result:

ok "682167889"

Test #27:

score: 0
Accepted
time: 39ms
memory: 502200kb

input:

6134 7 1
6 7 4 4 2 2 5 2 2 3 3 1 5 4 5 6 7 6 7 2 1 1 5 3 1 6 2 2 6 2 5 2 1 2 4 7 5 2 6 1 5 5 1 6 1 3 3 3 5 5 3 7 3 6 2 3 5 3 3 4 6 2 3 4 3 1 3 3 7 1 5 6 2 7 3 7 4 7 7 4 2 2 3 6 1 1 7 1 3 4 5 3 6 4 2 7 4 6 2 1 5 7 1 5 3 5 7 1 7 3 2 1 5 7 6 4 1 7 6 1 7 7 3 1 1 3 1 4 5 5 7 4 5 4 2 1 2 2 3 1 2 4 2 6 1 6...

output:

479862425

result:

ok "479862425"

Test #28:

score: 0
Accepted
time: 72ms
memory: 502500kb

input:

5712 9 1
1 3 9 3 2 9 8 7 4 5 1 2 1 1 3 9 9 5 2 1 9 2 4 5 3 9 9 6 3 1 5 5 2 5 2 8 2 2 1 9 8 5 2 8 6 5 3 3 9 9 6 5 6 7 1 2 3 4 4 5 3 6 6 6 6 2 8 5 3 7 2 5 3 9 6 4 7 2 6 5 1 2 4 3 3 5 9 3 9 6 9 5 4 6 2 4 7 8 3 1 9 7 4 8 1 7 1 7 1 3 8 6 2 4 1 7 6 3 2 3 1 8 6 4 1 6 6 8 7 6 3 5 1 2 7 4 6 5 8 3 2 3 7 7 9 3...

output:

800069213

result:

ok "800069213"

Test #29:

score: 0
Accepted
time: 55ms
memory: 505036kb

input:

13882 10 1
3 7 7 2 9 8 8 8 2 10 4 9 8 2 2 10 6 7 9 9 9 2 1 7 8 3 1 6 3 5 5 4 10 6 7 1 9 4 7 5 6 10 5 3 3 5 1 4 8 5 9 10 4 4 9 3 6 7 2 9 7 4 4 4 7 9 2 2 1 8 6 8 7 6 6 6 6 2 8 4 10 8 4 9 5 10 6 4 5 1 8 9 7 3 10 3 4 2 10 4 5 9 4 5 4 2 4 2 9 7 6 3 2 3 5 4 5 1 9 4 9 8 4 5 9 8 8 7 8 9 2 5 3 8 10 8 8 7 7 1...

output:

840192715

result:

ok "840192715"

Test #30:

score: 0
Accepted
time: 208ms
memory: 512476kb

input:

30000 15 1
7 14 1 2 8 11 12 11 15 9 6 2 12 12 15 1 4 5 12 9 5 8 5 11 13 6 2 5 12 10 14 3 8 9 12 11 4 7 5 15 9 2 11 15 11 14 11 15 15 1 1 11 11 1 9 6 4 14 9 6 14 8 6 1 7 7 10 5 8 7 5 7 9 3 5 6 3 11 13 2 14 14 5 10 12 14 6 10 9 13 13 10 6 15 7 15 1 6 15 8 1 13 2 15 13 5 10 8 14 9 1 12 3 8 10 15 2 6 6 ...

output:

930560461

result:

ok "930560461"

Test #31:

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

input:

30000 15 1
11 5 10 8 7 7 3 11 9 13 14 7 12 7 2 8 14 6 6 5 12 13 4 2 2 12 14 10 8 14 12 10 6 11 6 15 3 5 15 15 11 15 9 6 4 3 13 4 1 14 7 10 6 15 6 8 15 15 10 3 7 9 7 6 14 14 11 5 11 5 11 13 12 7 6 12 3 1 15 2 10 8 7 15 10 1 2 13 9 1 9 6 3 4 4 5 2 1 4 7 6 14 2 5 3 2 4 8 4 6 12 14 9 2 15 15 13 4 5 5 12...

output:

486842491

result:

ok "486842491"

Test #32:

score: 0
Accepted
time: 180ms
memory: 512544kb

input:

30000 15 1
14 15 10 14 13 2 12 13 6 8 7 15 2 6 8 15 10 3 5 3 5 11 8 12 5 9 12 13 4 13 1 5 2 12 3 14 15 6 13 9 13 5 15 2 14 13 6 3 12 14 6 15 1 14 3 1 5 13 11 5 13 8 13 12 13 10 10 6 1 10 1 1 9 11 1 10 12 4 12 8 11 13 10 12 15 3 6 3 14 10 1 15 7 13 15 3 8 5 11 7 6 13 10 3 2 10 2 13 12 9 7 2 12 11 9 4...

output:

50307243

result:

ok "50307243"

Test #33:

score: 0
Accepted
time: 207ms
memory: 512528kb

input:

30000 15 1
1 14 14 11 14 13 4 13 12 10 8 3 3 10 11 6 9 8 4 5 4 10 9 6 4 6 9 5 14 4 10 12 2 4 15 2 8 3 12 7 4 13 14 6 9 9 4 11 7 14 4 13 8 7 11 9 14 15 5 1 3 15 5 15 1 8 4 4 15 6 1 4 6 14 1 7 5 11 5 4 3 7 7 11 3 8 11 3 6 8 11 8 3 1 9 11 7 6 14 6 8 11 1 7 15 8 14 9 15 5 11 3 11 12 6 2 4 2 13 12 14 3 7...

output:

630828146

result:

ok "630828146"

Test #34:

score: 0
Accepted
time: 192ms
memory: 514080kb

input:

30000 15 1
7 7 11 14 7 10 7 6 10 9 12 2 2 8 11 10 15 12 2 8 11 13 8 9 14 10 4 3 4 10 9 11 3 6 6 13 6 11 7 11 8 10 9 1 9 7 14 1 6 8 10 13 11 10 14 13 2 13 4 13 15 5 8 2 2 1 10 1 10 13 3 7 14 11 4 4 6 5 5 6 15 3 7 14 6 13 11 2 1 6 15 7 7 5 5 9 13 6 15 6 5 10 3 13 4 15 10 1 15 12 5 11 12 7 2 3 3 8 7 15...

output:

953149809

result:

ok "953149809"

Test #35:

score: 0
Accepted
time: 227ms
memory: 512588kb

input:

30000 15 1
14 13 9 7 2 8 9 2 6 1 10 6 3 4 8 15 12 6 15 9 12 9 11 5 4 4 12 2 10 7 12 5 14 10 4 9 7 7 8 3 2 7 5 1 1 9 1 9 11 13 12 9 8 14 12 14 3 13 5 1 1 9 12 9 13 12 2 1 12 1 1 7 7 10 2 13 11 3 10 15 15 12 1 13 9 2 3 3 1 12 5 5 11 15 15 5 12 12 4 13 5 5 4 2 2 3 9 10 6 5 8 4 1 1 14 6 4 14 8 8 3 15 12...

output:

54181826

result:

ok "54181826"

Test #36:

score: 0
Accepted
time: 208ms
memory: 514136kb

input:

30000 15 1
13 2 6 13 3 1 15 9 4 13 11 14 13 5 3 15 3 12 2 12 11 2 3 13 5 8 2 4 9 11 14 14 8 1 1 7 1 15 4 4 12 13 7 1 11 10 15 6 14 5 4 15 5 8 9 6 14 15 3 3 15 11 10 3 12 3 7 2 8 3 7 2 9 5 4 8 5 14 11 2 7 11 6 11 6 11 14 1 15 1 1 15 5 15 7 5 11 1 3 5 8 11 1 11 4 10 4 10 6 15 1 12 5 10 12 13 15 7 8 6 ...

output:

415874796

result:

ok "415874796"

Test #37:

score: 0
Accepted
time: 52ms
memory: 499324kb

input:

30000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1

result:

ok "1"

Test #38:

score: 0
Accepted
time: 55ms
memory: 503336kb

input:

30000 15 1
14 15 15 15 15 15 14 14 14 15 15 15 14 14 14 15 15 14 15 15 15 15 14 15 15 15 14 15 14 15 14 14 15 14 14 14 14 14 15 14 14 15 14 14 14 15 14 14 15 14 15 15 15 15 15 14 15 15 15 14 15 15 14 15 14 15 15 15 15 15 15 14 15 14 14 14 15 15 15 14 14 15 14 15 14 15 14 14 15 14 15 14 15 14 14 14 1...

output:

886986198

result:

ok "886986198"

Test #39:

score: 0
Accepted
time: 39ms
memory: 503488kb

input:

30000 15 1
15 15 15 14 14 15 15 14 14 14 14 15 14 15 14 15 15 14 14 14 14 15 14 15 14 14 14 14 15 15 15 14 14 14 15 15 15 15 15 15 15 15 14 14 15 14 15 15 14 14 14 14 15 15 14 15 14 15 15 15 14 15 15 15 14 15 14 15 14 15 14 14 14 15 15 14 14 15 14 15 14 14 14 14 14 14 15 14 15 15 15 14 15 15 14 15 1...

output:

668247064

result:

ok "668247064"

Test #40:

score: 0
Accepted
time: 24ms
memory: 505224kb

input:

30000 15 1
15 14 15 14 15 15 15 14 14 14 15 14 15 15 14 14 15 14 15 15 15 14 15 15 14 14 14 14 15 15 14 14 15 15 15 14 15 15 15 15 15 14 14 15 14 14 14 14 15 15 15 14 14 14 14 14 14 15 14 14 14 14 14 15 15 14 15 15 15 14 14 15 15 15 14 14 15 14 15 14 15 14 15 15 15 15 15 15 14 15 15 14 15 14 14 15 1...

output:

562849724

result:

ok "562849724"

Test #41:

score: 0
Accepted
time: 44ms
memory: 502636kb

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

673429076

result:

ok "673429076"

Test #42:

score: 0
Accepted
time: 63ms
memory: 504520kb

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

516022986

result:

ok "516022986"

Test #43:

score: 0
Accepted
time: 243ms
memory: 512576kb

input:

30000 15 1
1 15 1 15 1 1 1 15 1 1 15 15 15 1 1 15 15 15 1 1 1 1 15 1 15 15 1 1 15 1 1 1 1 1 1 15 1 15 15 1 15 15 15 1 1 15 1 1 1 15 15 15 1 1 1 1 1 15 15 1 1 1 15 1 1 15 15 15 15 1 1 15 1 1 1 1 15 15 15 15 15 1 15 15 1 1 15 1 1 15 15 1 15 15 15 1 15 1 1 15 15 15 15 1 15 1 1 15 1 15 1 15 1 1 1 15 1 1...

output:

115103138

result:

ok "115103138"

Test #44:

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

input:

30000 15 1
15 1 15 15 1 15 15 15 15 1 15 1 1 1 15 15 15 1 1 1 1 1 1 15 15 15 1 1 1 15 15 15 15 1 1 15 1 15 1 15 1 1 15 15 15 1 1 1 1 1 1 1 1 1 15 15 1 15 1 15 15 1 15 1 1 1 1 1 15 15 15 1 15 15 15 15 1 15 1 1 15 15 1 15 15 15 1 15 15 15 15 1 1 1 1 15 1 15 1 15 1 15 1 15 15 15 1 15 15 1 15 1 1 1 1 1 ...

output:

777366768

result:

ok "777366768"

Test #45:

score: 0
Accepted
time: 229ms
memory: 512512kb

input:

30000 15 1
1 1 15 1 1 15 1 15 1 1 15 15 1 1 1 1 15 1 1 1 15 15 15 15 1 15 1 1 15 1 1 1 15 15 15 1 15 15 1 1 15 1 15 15 1 1 15 15 15 1 1 1 1 15 1 1 1 15 15 15 1 15 15 15 1 1 15 1 15 1 1 1 1 15 1 15 15 1 1 1 1 1 15 1 1 15 15 1 15 1 1 15 15 1 15 15 1 1 1 1 1 1 15 15 15 1 1 15 1 15 15 15 1 1 15 15 1 15 ...

output:

879322138

result:

ok "879322138"

Test #46:

score: 0
Accepted
time: 50ms
memory: 502716kb

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

354391629

result:

ok "354391629"

Test #47:

score: 0
Accepted
time: 56ms
memory: 512592kb

input:

30000 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

666493861

result:

ok "666493861"

Test #48:

score: 0
Accepted
time: 126ms
memory: 514336kb

input:

30000 15 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1...

output:

640857910

result:

ok "640857910"

Test #49:

score: 0
Accepted
time: 118ms
memory: 514092kb

input:

30000 15 1
1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1...

output:

370646039

result:

ok "370646039"

Test #50:

score: 0
Accepted
time: 97ms
memory: 512588kb

input:

30000 15 1
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

553300345

result:

ok "553300345"

Test #51:

score: 0
Accepted
time: 296ms
memory: 505948kb

input:

23069 10 12025
4 2 8 7 5 4 10 6 5 10 1 10 1 4 4 10 5 7 7 3 5 5 7 4 7 2 6 8 9 2 7 8 2 7 3 7 9 5 10 2 5 10 9 10 8 10 9 3 4 1 4 6 5 5 10 7 1 7 2 8 2 3 8 8 10 9 9 4 1 3 7 5 1 1 4 7 3 6 9 8 7 6 1 7 8 1 7 9 9 8 3 4 8 6 4 8 8 8 7 1 1 5 5 10 9 1 8 8 5 10 9 2 3 10 9 2 7 8 10 5 10 10 8 6 7 8 6 8 9 5 6 1 10 10...

output:

968505026
55485091
361959346
283015680
679237632
483478779
307144355
11544202
502008227
137763897
982935997
27264320
127349300
99734190
670547928
841455638
841455638
301643587
83331998
691289897
731349157
61957510
947528086
947528086
675446634
225148878
288646400
742863125
381490210
381490210
469827...

result:

ok 12025 tokens

Test #52:

score: 0
Accepted
time: 352ms
memory: 506444kb

input:

23602 8 25014
1 8 2 8 2 6 5 4 5 7 1 7 5 1 1 7 5 1 7 5 1 2 2 3 7 2 6 7 7 3 3 5 4 2 5 2 1 5 6 2 6 8 3 8 7 3 2 1 1 7 1 6 2 1 2 2 4 1 4 2 8 6 1 4 5 4 6 3 7 4 7 5 8 2 6 4 5 3 2 3 2 6 2 1 1 2 6 7 3 5 3 1 6 5 1 4 8 8 4 2 4 4 2 6 5 2 4 2 7 1 5 1 5 5 5 3 4 6 5 7 4 8 1 8 2 1 8 2 1 2 1 1 6 8 2 7 1 5 3 1 1 2 2 ...

output:

541177119
162234248
440904283
440904283
579266741
971024033
656440670
656440670
925808612
104007635
778759007
559638022
39631014
252123373
106588833
786024463
450259677
62557367
636807778
642532807
989365725
69307623
348298986
464398648
464398648
766281407
791933041
922191335
51856525
51856525
51856...

result:

ok 25014 tokens

Test #53:

score: 0
Accepted
time: 334ms
memory: 504364kb

input:

25107 7 28960
1 5 1 1 6 1 1 6 2 6 5 5 7 1 7 5 4 2 3 2 5 2 1 4 4 1 2 1 3 7 7 4 7 6 6 7 2 4 5 3 3 5 1 3 6 5 2 4 3 2 5 3 5 5 7 2 6 2 6 2 5 3 6 6 7 2 7 5 6 2 6 4 6 4 2 6 4 4 5 1 3 5 5 3 5 3 2 4 1 4 4 1 5 3 7 1 6 3 4 1 5 3 2 7 2 4 2 4 6 4 4 2 2 5 1 4 7 7 2 4 3 5 1 5 5 6 7 6 6 6 4 3 1 2 7 2 3 5 7 1 4 6 6 ...

output:

199053210
516843380
93977920
994981348
442686656
623060698
732931746
589908424
84272632
951269247
416915741
492718603
859538916
104801350
104801350
864382357
205550713
106464008
99814418
199959150
341431732
341431732
934166748
281772142
976679351
447471840
34027970
897467716
119027561
756889039
7680...

result:

ok 28960 tokens

Test #54:

score: 0
Accepted
time: 178ms
memory: 506440kb

input:

13962 13 3707
4 6 12 5 13 11 7 10 1 7 10 2 3 10 3 13 8 5 12 13 4 9 1 13 8 4 7 1 6 12 13 1 13 10 10 6 9 2 9 9 4 3 10 12 3 4 9 10 6 4 7 9 7 10 3 1 3 1 11 13 7 11 2 13 2 10 5 5 11 1 11 13 9 6 8 8 4 4 1 11 7 7 13 1 9 8 7 13 7 6 6 9 4 7 10 12 9 2 10 8 3 12 5 5 12 8 5 2 5 11 10 7 6 2 4 9 3 3 9 8 4 11 3 7 ...

output:

276109416
840238204
694858458
664652304
286153540
666015604
443262601
575437164
359340320
157504118
352213706
58396765
546877234
614428039
609590093
795973112
178492641
825384521
941188876
714749531
548944676
548944676
364923716
729847432
591148054
978781901
736900663
736900663
692684825
647423253
9...

result:

ok 3707 tokens

Test #55:

score: 0
Accepted
time: 452ms
memory: 508216kb

input:

18584 13 14364
10 11 4 10 8 10 10 8 9 3 11 9 9 7 4 8 4 12 10 8 10 12 2 13 2 4 7 12 10 3 10 4 6 5 9 8 11 4 2 6 8 7 1 4 13 8 11 11 4 2 2 12 2 4 8 1 13 6 4 7 10 11 3 7 10 12 9 1 3 10 12 5 10 7 11 3 10 13 2 10 4 6 11 8 7 8 2 5 10 7 7 1 1 5 12 10 7 5 3 2 8 4 12 2 4 11 12 5 9 2 4 5 3 11 13 7 1 9 5 13 1 1 ...

output:

658709022
497231145
871575369
258501464
499540539
482627339
341365782
144778896
808883262
565147088
113575925
728645018
388249791
312547060
94372671
50816229
816496597
891308538
261249127
639631151
291100596
941452278
323552752
278537075
90711667
930283262
258822286
674851472
792959367
968689642
704...

result:

ok 14364 tokens

Test #56:

score: 0
Accepted
time: 367ms
memory: 509436kb

input:

28547 12 10076
5 3 11 6 10 3 1 6 12 12 2 10 4 1 1 1 11 5 11 7 7 12 4 10 5 7 6 6 10 2 7 6 8 7 7 9 10 10 8 9 11 5 4 12 9 9 11 8 11 7 10 11 4 8 8 7 10 11 9 4 4 9 9 4 3 12 11 10 6 8 9 3 4 10 2 3 9 4 9 11 10 1 9 10 4 12 8 12 6 4 4 1 1 3 7 6 11 2 12 4 12 4 1 5 2 6 10 4 5 2 7 3 7 10 10 4 9 2 8 10 9 6 7 3 5...

output:

885664536
885664536
23889076
456414884
456414884
539163546
952326779
952326779
193910068
715078137
893170269
377884337
361564758
212928322
959212520
746410474
704821236
759627885
3694311
740124339
46628499
338179891
242514922
255559380
64018819
308244426
877375429
756506505
956562987
956562987
89896...

result:

ok 10076 tokens

Test #57:

score: 0
Accepted
time: 39ms
memory: 500960kb

input:

1407 3 8746
2 3 1 2 3 1 1 3 2 2 3 3 1 2 3 2 2 3 3 1 2 3 3 3 2 3 1 1 1 1 3 2 1 1 1 3 1 2 3 1 2 3 1 2 2 2 1 2 2 2 2 1 2 3 1 3 2 1 1 2 2 1 3 2 2 2 2 2 1 2 3 1 3 1 3 2 3 2 2 3 3 3 1 3 1 3 2 1 1 2 2 2 2 2 2 2 2 1 2 3 2 2 3 3 1 2 2 3 1 3 3 1 1 3 3 1 2 2 1 3 3 1 2 3 3 1 3 3 3 1 1 1 3 3 1 3 2 2 3 3 2 2 2 1 ...

output:

523300148
523300148
48355943
523300148
48355943
523300148
784950222
784950222
784950222
784950222
71672392
71672392
71672392
71672392
71672392
390161532
390161532
390161532
390161532
390161532
24605749
24605749
24605749
24605749
511425051
340950034
340950034
392559473
404218891
701231622
382777659
3...

result:

ok 8746 tokens

Test #58:

score: 0
Accepted
time: 1157ms
memory: 514432kb

input:

30000 15 30000
12 7 10 15 5 2 11 4 7 12 2 12 6 6 1 5 11 7 1 4 14 12 15 6 1 15 7 1 4 5 9 5 11 6 4 12 1 11 14 8 8 6 15 10 11 11 11 4 4 2 11 10 3 5 10 1 1 6 5 11 11 8 12 2 5 4 7 4 2 5 3 6 5 1 13 4 2 11 10 7 3 15 6 15 13 4 10 2 11 4 4 11 12 5 4 2 9 15 4 9 12 5 9 1 10 7 15 14 14 11 14 7 10 7 7 10 10 3 3 ...

output:

422825564
173618451
369359593
320019089
822965970
520883044
806325492
369272646
490312261
276458720
297112238
902887719
359707127
648508474
460078842
111250807
233596313
332001014
694787936
388363595
505553734
125839435
353657423
74619701
520944322
978282345
871352168
159818860
620006959
333023627
5...

result:

ok 30000 tokens

Test #59:

score: 0
Accepted
time: 1158ms
memory: 513672kb

input:

30000 15 30000
6 2 2 11 3 3 2 5 4 1 9 11 2 10 1 10 9 9 10 2 8 10 14 8 10 13 6 8 8 3 4 4 14 4 14 2 12 12 7 8 3 2 9 2 14 11 9 4 9 1 10 8 3 2 4 7 14 11 6 15 14 12 6 1 10 13 4 10 11 2 8 4 7 10 2 5 15 8 8 9 7 11 15 14 12 1 7 13 5 14 6 7 8 11 14 13 13 4 5 5 7 7 15 11 14 14 9 4 2 13 6 6 15 15 15 8 12 10 13...

output:

911850639
306319924
704128449
774810437
723572106
745848746
996839028
540861711
690484474
567044611
532989909
837374986
604256643
228528261
479173379
91352124
76735246
510362953
812042680
822703379
96627561
31861849
705093455
806658813
38850320
823895999
763777444
63070413
444277867
143317154
829787...

result:

ok 30000 tokens

Test #60:

score: 0
Accepted
time: 1154ms
memory: 512716kb

input:

30000 15 30000
1 3 3 2 1 6 11 6 4 5 8 8 2 8 14 9 10 3 8 2 10 13 2 4 13 14 3 11 14 4 4 10 1 13 8 12 2 10 13 10 5 13 10 7 1 12 10 1 14 12 13 14 14 6 11 13 4 8 9 2 9 2 7 12 13 1 3 9 12 12 14 1 3 13 14 4 9 1 13 3 7 8 6 4 6 5 5 11 6 13 9 12 14 7 5 14 11 10 7 3 2 12 4 15 13 8 3 7 4 7 9 6 1 14 4 13 10 11 1...

output:

695654402
44021274
254792959
693770195
566765790
324209157
119611695
617317219
301196910
804178987
382874052
942441736
413566869
409687723
414634185
669694655
543808857
256146538
67809146
834834286
653593698
860384091
992193686
414986262
14111135
354882059
802547633
318815276
592492221
810356830
498...

result:

ok 30000 tokens

Test #61:

score: 0
Accepted
time: 1180ms
memory: 513904kb

input:

30000 15 30000
2 7 15 12 15 10 7 15 9 12 5 15 15 6 7 5 6 13 9 7 4 2 15 6 14 3 8 3 6 12 2 6 7 1 2 15 11 13 12 14 7 13 8 1 9 14 11 5 3 8 14 3 5 3 4 12 1 12 11 3 2 3 2 10 1 13 1 7 13 15 7 3 9 10 6 5 1 2 7 11 4 15 12 4 13 14 14 7 12 5 9 3 10 13 1 10 7 6 3 1 2 7 1 1 2 9 13 15 13 13 10 13 8 6 11 5 14 11 1...

output:

144411293
269002213
124284731
376229243
210868296
130318287
767330290
100032485
686506705
436229375
366854883
535501260
655239997
723808410
311160595
716934593
813285259
608332841
336926304
673852608
7184886
267547351
300856584
656010697
867332696
84392952
552200686
624771665
570597968
841674781
309...

result:

ok 30000 tokens

Test #62:

score: 0
Accepted
time: 1184ms
memory: 512816kb

input:

30000 15 30000
10 2 5 11 7 14 13 2 14 12 15 11 14 5 10 8 11 7 4 9 8 15 2 9 7 15 3 2 3 13 14 5 6 5 10 13 6 4 9 14 6 1 13 1 13 10 9 1 1 13 8 4 1 9 12 14 11 6 14 8 6 7 12 13 8 13 14 14 12 11 9 5 8 14 3 14 3 12 13 1 12 14 7 1 12 1 14 15 13 5 13 9 3 9 12 13 11 11 10 15 5 15 10 12 5 10 10 15 4 5 2 15 5 1 ...

output:

277733635
237579028
180832486
704228788
605345120
891501570
230297208
717621293
16772585
519449810
349956873
317148184
882401416
391888896
613464099
573145292
210929203
699445337
206163165
514952921
164680380
717412599
167755887
664483528
617617081
294884241
646564297
772905926
696720290
529046725
8...

result:

ok 30000 tokens

Test #63:

score: 0
Accepted
time: 1161ms
memory: 514460kb

input:

30000 15 30000
4 11 7 4 4 12 11 4 12 14 14 8 14 4 14 3 8 4 3 3 12 11 5 4 13 1 6 13 15 15 14 5 12 11 1 15 11 6 10 2 2 11 10 10 7 10 11 2 11 6 4 8 9 6 7 7 15 9 13 15 15 13 14 15 13 11 5 13 1 4 12 8 1 2 2 5 13 8 15 4 3 6 9 14 13 3 12 9 15 6 2 13 9 4 8 15 10 13 7 6 3 8 6 15 9 10 11 2 11 11 14 8 10 6 13 ...

output:

176911054
192496265
229759211
677501694
730256044
125595902
97624243
125426053
505701065
670834234
143071404
67409584
197160379
754101840
532983156
190029336
183929637
157999763
684942416
752527933
77521510
677163517
293235383
635573878
970359073
379556449
258040697
352726849
992955172
92948500
2684...

result:

ok 30000 tokens

Test #64:

score: 0
Accepted
time: 1160ms
memory: 513996kb

input:

30000 15 30000
9 8 10 11 12 14 8 13 4 3 8 15 12 14 1 9 11 8 7 2 5 13 10 13 12 9 9 14 14 9 15 1 9 15 4 12 5 12 12 15 12 3 10 7 10 5 3 1 9 6 10 15 9 10 3 15 1 11 1 11 8 9 3 6 4 10 10 1 3 13 6 7 11 8 8 8 9 10 2 14 13 1 8 3 4 3 8 3 1 5 6 1 8 6 12 10 12 3 1 14 2 9 3 11 15 6 8 5 6 2 14 11 9 1 8 8 3 1 2 6 ...

output:

288608384
479424503
19861618
965843147
666999743
826900204
200513189
55241793
266573584
522764094
608828540
888444240
684634228
308258526
799673534
784028889
603264038
994290278
795285562
234659887
512038296
595129357
414604643
972952179
44656275
287014373
518293475
657934701
778817341
766374702
731...

result:

ok 30000 tokens

Test #65:

score: 0
Accepted
time: 356ms
memory: 502960kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #66:

score: 0
Accepted
time: 335ms
memory: 502956kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #67:

score: 0
Accepted
time: 348ms
memory: 502964kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #68:

score: 0
Accepted
time: 404ms
memory: 504924kb

input:

30000 15 30000
15 15 15 14 14 14 15 15 14 15 15 15 14 15 15 15 14 15 15 15 14 15 14 15 14 14 14 14 14 14 15 15 14 14 15 14 14 15 14 15 14 14 14 15 14 14 14 15 14 15 14 14 14 15 15 15 14 15 14 15 14 14 14 15 14 14 14 14 15 15 15 15 14 15 14 14 14 15 14 15 14 14 14 15 14 15 14 15 15 14 15 15 14 15 14 ...

output:

271303973
393197562
242411169
564512217
413395002
830609754
19828254
648605494
468904844
761697230
409067600
761697230
892942863
281479889
735134544
300358846
130831501
467669709
718657262
467669709
288885758
353802173
514478210
988186286
200140084
801984458
202058806
801984458
103702931
206100357
8...

result:

ok 30000 tokens

Test #69:

score: 0
Accepted
time: 388ms
memory: 505248kb

input:

30000 15 30000
15 15 14 15 15 15 14 15 14 15 14 15 15 15 14 15 15 14 15 14 14 14 14 14 15 14 14 14 15 15 15 15 14 15 14 14 15 15 14 14 15 14 15 14 15 14 15 15 14 14 14 15 15 14 14 14 14 14 15 15 15 14 14 15 14 14 15 14 14 15 14 14 15 15 15 14 15 15 14 14 14 14 15 15 15 14 15 14 15 15 15 15 15 14 14 ...

output:

144286857
139929931
482364038
778779991
373367544
640112819
767474108
166148260
439230524
454881360
64049068
555245277
481485550
555245277
158950371
567652772
158950371
289891502
810282968
483253164
974654751
658763223
757484856
569464391
278295284
809395835
577462905
737197266
628910641
393789076
1...

result:

ok 30000 tokens

Test #70:

score: 0
Accepted
time: 392ms
memory: 505008kb

input:

30000 15 30000
14 15 14 15 14 14 15 15 14 14 15 14 15 15 15 14 14 14 15 15 15 15 14 14 14 15 14 15 15 14 14 15 14 14 15 15 14 15 14 15 15 14 14 14 15 15 15 15 14 15 14 14 14 14 15 15 15 14 14 14 15 15 14 14 14 14 15 15 15 15 14 14 14 14 14 14 14 14 15 14 14 14 14 15 15 15 15 15 15 15 14 15 15 15 15 ...

output:

934044862
786017894
123126924
132826079
123126924
389860364
4703120
389860364
45519774
901100612
330646678
703911303
481508126
106354267
764554326
587180464
793987507
273450870
589200097
407757573
437947314
650915897
219753770
460144593
141417431
574726287
516090915
250056301
152233410
388242277
731...

result:

ok 30000 tokens

Test #71:

score: 0
Accepted
time: 1637ms
memory: 512752kb

input:

30000 15 30000
15 1 15 1 1 15 15 15 15 15 1 15 15 15 1 15 15 15 1 1 15 1 1 1 1 15 1 15 15 15 1 1 1 15 15 15 15 15 15 15 1 15 1 1 15 15 1 1 1 15 1 1 1 1 15 1 1 15 1 15 15 15 1 1 1 1 15 15 15 1 1 15 15 1 15 15 15 1 15 15 15 15 15 1 1 1 15 1 1 15 15 15 15 15 15 1 1 1 1 1 1 1 1 1 1 1 15 15 15 15 15 1 15...

output:

327899433
273530187
109975393
131223449
109975393
548940291
248149541
644812394
248149541
727510056
930207310
370920892
91277683
272283673
91277683
370920892
572591615
137191735
674642351
577373145
667351777
488161966
123859088
859641967
915697269
859641967
915697269
760513994
915697269
813823203
43...

result:

ok 30000 tokens

Test #72:

score: 0
Accepted
time: 1595ms
memory: 512908kb

input:

30000 15 30000
1 1 1 15 1 1 1 15 1 15 1 1 15 1 1 1 15 1 15 1 1 15 1 1 1 15 1 1 15 1 1 15 15 15 1 1 1 1 15 15 1 15 15 15 1 15 1 1 1 1 15 15 15 1 15 15 15 1 15 15 1 15 15 15 1 1 15 15 1 15 15 15 15 1 15 15 15 1 15 1 1 15 15 15 1 15 1 1 1 1 1 15 15 1 15 15 1 15 1 1 1 15 15 1 1 1 1 15 15 1 1 15 1 15 1 1...

output:

957107477
381191213
134732105
24492869
367393035
24492869
692199425
589689690
692199425
816738972
145619034
687023420
322907770
403792323
67418727
366686312
585320063
793846121
212653884
195075201
212653884
842925198
664945734
989986833
874381553
967413046
113235969
319501450
583156039
441860480
103...

result:

ok 30000 tokens

Test #73:

score: 0
Accepted
time: 1591ms
memory: 514024kb

input:

30000 15 30000
1 15 1 1 1 1 1 15 1 1 15 15 15 15 1 1 15 1 1 1 15 15 15 15 1 15 15 15 1 1 15 15 15 1 1 15 1 15 1 15 15 1 15 15 15 15 1 1 1 15 15 15 1 1 15 15 1 1 15 1 15 1 1 15 1 1 15 1 1 15 1 1 15 1 15 1 15 15 1 15 15 1 15 15 1 15 15 1 15 1 1 1 15 15 15 15 15 1 15 15 15 15 15 1 15 1 15 1 1 15 1 15 1...

output:

885998411
312799576
689490755
378714168
624194223
378714168
885998411
591463549
378906488
855869619
859112049
624700039
957051983
380358803
906974272
127014575
485392124
165458722
485392124
293171389
195129029
930446729
195129029
930446729
979524346
930446729
445450889
12516368
241242971
12516368
44...

result:

ok 30000 tokens

Test #74:

score: 0
Accepted
time: 1172ms
memory: 508516kb

input:

30000 15 30000
14 14 15 14 14 14 14 14 14 15 15 14 14 14 15 14 14 14 15 14 15 15 14 14 15 15 15 15 15 15 15 14 15 15 14 14 14 14 14 14 15 14 15 15 15 14 14 14 14 14 14 15 14 14 14 15 14 14 14 15 15 15 14 14 15 14 15 14 14 14 15 14 14 14 14 15 14 14 14 15 14 15 15 15 15 14 14 14 14 14 15 15 15 15 14 ...

output:

559144059
176936220
761538112
813251100
876179632
226602662
10077336
37101663
764478744
764478744
808524556
17222647
433042077
433042077
154037043
154037043
958908974
958908974
550285500
582629587
783558978
348842093
444809574
879511458
347755031
347755031
938745588
938745588
636055074
636055074
974...

result:

ok 30000 tokens

Test #75:

score: 0
Accepted
time: 1210ms
memory: 507176kb

input:

30000 15 30000
14 15 15 14 14 15 14 15 14 14 14 14 14 15 14 15 15 14 14 14 15 15 15 15 15 14 14 14 15 14 15 14 15 14 15 14 15 15 14 14 14 15 15 15 14 14 14 15 15 15 15 14 14 15 15 15 14 15 14 15 15 14 14 14 15 14 15 15 14 15 14 15 15 15 14 14 14 15 15 14 14 14 14 15 14 15 14 14 15 14 15 15 14 14 15 ...

output:

891448418
866843958
176519646
176519646
116756294
116756294
594445301
361980982
540094246
540094246
125976558
162978189
395234138
395234138
734739729
734739729
12865452
12865452
689667580
689667580
180876541
784234043
300268952
810166468
993459747
993459747
970699461
762374651
849852584
849852584
18...

result:

ok 30000 tokens

Test #76:

score: 0
Accepted
time: 1150ms
memory: 507236kb

input:

30000 15 30000
14 14 14 14 14 15 14 14 15 15 15 14 14 14 14 15 14 14 15 15 15 15 15 15 15 15 14 14 14 14 15 14 14 15 14 14 15 15 14 15 15 14 15 14 14 14 15 14 15 14 14 14 15 15 14 15 15 15 14 14 14 14 14 14 14 15 14 15 14 14 14 14 14 14 14 15 14 14 15 14 15 15 14 14 14 14 15 15 15 15 15 15 15 14 15 ...

output:

692028145
692028145
62484031
62484031
867622764
867622764
724766884
724766884
88791421
88791421
573896963
146947883
60463571
193535368
537511842
394110625
715438485
895531038
125966928
298144165
427567018
812712667
434027841
434027841
875969697
875969697
262350710
262350710
542268879
542268879
78945...

result:

ok 30000 tokens

Test #77:

score: 0
Accepted
time: 1038ms
memory: 503024kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
...

result:

ok 30000 tokens

Test #78:

score: 0
Accepted
time: 1008ms
memory: 502840kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022...

result:

ok 30000 tokens

Test #79:

score: 0
Accepted
time: 1071ms
memory: 504044kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
...

result:

ok 30000 tokens

Test #80:

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

input:

30000 1 30000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 30000 tokens

Extra Test:

score: 0
Extra Test Passed