QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#792564#9438. Two BoxMade_in_CodeAC ✓915ms303056kbC++1411.1kb2024-11-29 11:28:332024-11-29 11:28:33

Judging History

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

  • [2024-11-29 11:28:33]
  • 评测
  • 测评结果:AC
  • 用时:915ms
  • 内存:303056kb
  • [2024-11-29 11:28:33]
  • 提交

answer

#include <iostream>
#define LL long long

using namespace std;

const int kMaxN = 3e4 + 1, kMaxM = 15 + 1, kMod = 998244353, kInv2 = kMod + 1 >> 1;
int n, m, q, a[kMaxN];
LL f[kMaxM - 1][kMaxN][kMaxM];
LL fwt[kMaxM][kMaxM][kMaxM], inv[kMaxM];
LL trans[kMaxM][kMaxN][kMaxM];

class Seg1 {  // Dp 数组
 public:
  struct V {
    LL f[kMaxM];
  };

 private:
  V v[kMaxN << 2];
  int o;

  V Merge(V &x, V &y) {
    static V ans;
    for (int i = 0; i <= o; i++) {
      ans.f[i] = x.f[i] * y.f[i] % kMod;
    }
    return ans;
  }

  void Update(int p, int x) {
    for (int i = 0; i <= o; i++) {
      v[p].f[i] = f[o][x][i];
    }
  }

  void Init(int p, int l, int r) {
    if (l == r) {
      return Update(p, l);
    }
    int mid = l + r >> 1;
    Init(p << 1, l, mid);
    Init(p << 1 | 1, mid + 1, r);
    v[p] = Merge(v[p << 1], v[p << 1 | 1]);
  }

  void Update(int p, int l, int r, int x) {
    if (l == r) {
      return Update(p, x);
    }
    int mid = l + r >> 1;
    if (mid >= x) {
      Update(p << 1, l, mid, x);
    } else {
      Update(p << 1 | 1, mid + 1, r, x);
    }
    v[p] = Merge(v[p << 1], v[p << 1 | 1]);
  }

  V Ask(int p, int l, int r, int _l, int _r) {
    if (l >= _l && r <= _r) {
      return v[p];
    }
    int mid = l + r >> 1;
    if (mid >= _l && mid < _r) {
      V x = Ask(p << 1, l, mid, _l, _r);
      V y = Ask(p << 1 | 1, mid + 1, r, _l, _r);
      return Merge(x, y);
    } else if (mid >= _l) {
      return Ask(p << 1, l, mid, _l, _r);
    } else {
      return Ask(p << 1 | 1, mid + 1, r, _l, _r);
    }
  }

 public:
  void Init(int _o) { o = _o, Init(1, 1, n); }
  void Update(int x) { Update(1, 1, n, x); }
  V Ask(int l, int r) { return Ask(1, 1, n, l, r); }
} seg1[kMaxM - 1];

class Seg2 {  // =i 的连续段相关
 public:
  struct V {
    int s, c;   // =i 的数量, =i 的段数
    bool l, r;  // 左边是否是 =i, 右边是否是 =i
  };

 private:
  V v[kMaxN << 2];
  int o;

  V Merge(V &x, V &y) {
    static V ans;
    ans.s = x.s + y.s, ans.c = x.c + y.c - (x.r && y.l);
    ans.l = x.l, ans.r = y.r;
    return ans;
  }

  void Update(int p, int x) {
    v[p].s = v[p].c = v[p].l = v[p].r = a[x] == o;
  }

  void Init(int p, int l, int r) {
    if (l == r) {
      return Update(p, l);
    }
    int mid = l + r >> 1;
    Init(p << 1, l, mid);
    Init(p << 1 | 1, mid + 1, r);
    v[p] = Merge(v[p << 1], v[p << 1 | 1]);
  }

  void Update(int p, int l, int r, int x) {
    if (l == r) {
      return Update(p, x);
    }
    int mid = l + r >> 1;
    if (mid >= x) {
      Update(p << 1, l, mid, x);
    } else {
      Update(p << 1 | 1, mid + 1, r, x);
    }
    v[p] = Merge(v[p << 1], v[p << 1 | 1]);
  }

  V Ask(int p, int l, int r, int _l, int _r) {
    if (l >= _l && r <= _r) {
      return v[p];
    }
    int mid = l + r >> 1;
    if (mid >= _l && mid < _r) {
      V x = Ask(p << 1, l, mid, _l, _r);
      V y = Ask(p << 1 | 1, mid + 1, r, _l, _r);
      return Merge(x, y);
    } else if (mid >= _l) {
      return Ask(p << 1, l, mid, _l, _r);
    } else {
      return Ask(p << 1 | 1, mid + 1, r, _l, _r);
    }
  }

 public:
  void Init(int _o) { o = _o, Init(1, 1, n); }
  void Update(int x) { Update(1, 1, n, x); }
  V Ask(int l, int r) { return Ask(1, 1, n, l, r); }
} seg2[kMaxM - 1];

class Seg3 {  // >= i 的连续段相关
  int v[kMaxN << 2], o;

  void Init(int p, int l, int r) {
    if (l == r) {
      v[p] = a[l] >= o;
      return;
    }
    int mid = l + r >> 1;
    Init(p << 1, l, mid);
    Init(p << 1 | 1, mid + 1, r);
    v[p] = v[p << 1] + v[p << 1 | 1];
  }

  void Update(int p, int l, int r, int x) {
    if (l == r) {
      v[p] = a[x] >= o;
      return;
    }
    int mid = l + r >> 1;
    if (mid >= x) {
      Update(p << 1, l, mid, x);
    } else {
      Update(p << 1 | 1, mid + 1, r, x);
    }
    v[p] = v[p << 1] + v[p << 1 | 1];
  }

  int FindPre(int p, int l, int r) {
    if (v[p] == r - l + 1) {
      return 1;
    } else if (l == r) {
      return l + 1;
    }
    int mid = l + r >> 1;
    if (v[p << 1 | 1] == r - mid) {
      return FindPre(p << 1, l, mid);
    } else {
      return FindPre(p << 1 | 1, mid + 1, r);
    }
  }

  int FindPre(int p, int l, int r, int x) {
    if (r <= x) {
      return FindPre(p, l, r);
    }
    int mid = l + r >> 1, ans = 1;
    if (mid < x) {
      ans = FindPre(p << 1 | 1, mid + 1, r, x);
    }
    if (ans == 1) {
      ans = FindPre(p << 1, l, mid, x);
    }
    return ans;
  }

  int FindSuf(int p, int l, int r) {
    if (v[p] == r - l + 1) {
      return n;
    } else if (l == r) {
      return r - 1;
    }
    int mid = l + r >> 1;
    if (v[p << 1] == mid - l + 1) {
      return FindSuf(p << 1 | 1, mid + 1, r);
    } else {
      return FindSuf(p << 1, l, mid);
    }
  }

  int FindSuf(int p, int l, int r, int x) {
    if (l >= x) {
      return FindSuf(p, l, r);
    }
    int mid = l + r >> 1, ans = n;
    if (mid >= x) {
      ans = FindSuf(p << 1, l, mid, x);
    }
    if (ans == n) {
      ans = FindSuf(p << 1 | 1, mid + 1, r, x);
    }
    return ans;
  }

 public:
  void Init(int _o) { o = _o, Init(1, 1, n); }
  void Update(int x) { Update(1, 1, n, x); }
  int FindPre(int x) { return FindPre(1, 1, n, x); }
  int FindSuf(int x) { return FindSuf(1, 1, n, x); }
} seg3[kMaxM - 1];

void Init() {  // O(m^4+nm^3)
  static LL c[kMaxM][kMaxM] = {};
  for (int i = 0; i <= m; i++) {  // 计算组合数
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; j++) {
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % kMod;
    }
  }
  inv[0] = fwt[0][0][0] = 1;  // 计算 2^{-i} 以及在长度为 2^i 时 f_j 对 fwt_k 贡献的系数
  for (int i = 1; i <= m; i++) {
    inv[i] = inv[i - 1] * kInv2 % kMod;
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k <= i; k++) {
        for (int l = max(j + k - i, 0); l <= min(j, k); l++) {
          LL w = c[k][l] * c[i - k][j - l] % kMod;
          if (l & 1) {
            fwt[i][j][k] = (fwt[i][j][k] - w + kMod) % kMod;
          } else {
            fwt[i][j][k] = (fwt[i][j][k] + w) % kMod;
          }
        }
      }
    }
  }
  for (int i = 0; i <= m; i++) {  // 计算经过 j 个 =i 的转移后贡献的 fwt 数组
    for (int j = 0; j <= i; j++) {
      trans[i][0][j] = 1;
    }
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= i; k++) {
        trans[i][j][k] = trans[i][j - 1][k] * fwt[i][1][k] % kMod;
      }
    }
  }
}

void Dp() {  // O(nm^3)
  static LL h[kMaxM] = {};
  for (int i = 0; i < m; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 0; k <= i; k++) {
        f[i][j][k] = 1;
      }
    }
  }
  for (int i = m - 1; i >= 0; i--) {
    for (int l = 1, r = 1; l <= n; l = r) {
      for (; r <= n && (a[l] >= i) == (a[r] >= i); r++) {
      }
      if (a[l] >= i) {
        for (int j = 0; j <= i + 1; j++) {
          h[j] = 1;
        }
        int c = (a[l] == i) + (r <= n && a[r - 1] == i);
        for (int p = l, q = l; p < r; p = q) {
          for (; q < r && (a[p] > i) == (a[q] > i); q++) {
          }
          if (a[p] > i) {
            for (int j = 0; j <= i + 1; j++) {  // 异或卷积上一层的 Dp 值
              h[j] = h[j] * f[i + 1][p][j] % kMod;
            }
          } else {
            c += q - p - 1;  // 累计没有被上一层覆盖的转移数量
          }
        }
        for (int j = 0; j <= i + 1; j++) {  // 计算没有被上一层覆盖的转移
          h[j] = h[j] * trans[i + 1][c][j] % kMod;
        }
        LL *g = f[i][l];
        for (int j = 0; j <= i + 1; j++) {  // 还原 fwt 数组
          g[j] = 0;
          for (int k = 0; k <= i + 1; k++) {
            g[j] = (g[j] + h[k] * fwt[i + 1][k][j]) % kMod;
          }
          g[j] = g[j] * inv[i + 1] % kMod;
        }
        if (r == n + 1) {  // 之后没有限制, 需要将 f[s|1<<i] 累加入 f[s]
          for (int j = 0; j <= i; j++) {
            g[j] = (g[j] + g[j + 1]) % kMod;
          }
        }
        for (int j = 0; j <= i; j++) {  // 进行 fwt
          h[j] = 0;
          for (int k = 0; k <= i; k++) {
            h[j] = (h[j] + g[k] * fwt[i][k][j]) % kMod;
          }
        }
        for (int j = 0; j <= i; j++) {
          g[j] = h[j];
        }
        g[i + 1] = 0;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    seg1[i].Init(i), seg2[i].Init(i), seg3[i].Init(i);
  }
}

void ReDp(int i, int l, int r) {  // O(m^2+m\logn)
  static LL h[kMaxM];
  Seg1::V v1;
  if (i + 1 < m) {
    v1 = seg1[i + 1].Ask(l, r);  // 异或卷积上一层的 Dp 值
  } else {
    for (int j = 0; j <= m; j++) {
      v1.f[j] = 1;
    }
  }
  Seg2::V v2 = seg2[i].Ask(l, r);
  int c = v2.s - v2.c + (a[l] == i) + (r < n && a[r] == i);  // 累计没有被上一层覆盖的转移数量
  for (int j = 0; j <= i + 1; j++) {                         // 计算没有被上一层覆盖的转移
    v1.f[j] = v1.f[j] * trans[i + 1][c][j] % kMod;
  }
  LL *g = f[i][l];
  for (int j = 0; j <= i + 1; j++) {  // 还原 fwt 数组
    g[j] = 0;
    for (int k = 0; k <= i + 1; k++) {
      g[j] = (g[j] + v1.f[k] * fwt[i + 1][k][j]) % kMod;
    }
    g[j] = g[j] * inv[i + 1] % kMod;
  }
  if (r == n) {  // 之后没有限制, 需要将 f[s|1<<i] 累加入 f[s]
    for (int j = 0; j <= i; j++) {
      g[j] = (g[j] + g[j + 1]) % kMod;
    }
  }
  for (int j = 0; j <= i; j++) {  // 进行 fwt
    h[j] = 0;
    for (int k = 0; k <= i; k++) {
      h[j] = (h[j] + g[k] * fwt[i][k][j]) % kMod;
    }
  }
  for (int j = 0; j <= i; j++) {
    g[j] = h[j];
  }
  g[i + 1] = 0, seg1[i].Update(l);
}

void Change(int x, int y) {  // O(m^3+m^2\logn)
  if (a[x] == y) {
    return;
  }
  int z = a[x];
  a[x] = y, seg2[y].Update(x), seg2[z].Update(x);
  if (z < y) {
    for (int i = y; i > z; i--) {
      seg3[i].Update(x);
      int l = seg3[i].FindPre(x), r = seg3[i].FindSuf(x);
      if (r > x) {  // 删去 x+1 处的 Dp 值
        for (int j = 0; j <= i; j++) {
          f[i][x + 1][j] = 1;
        }
        seg1[i].Update(x + 1);
      }
      ReDp(i, l, r);
    }
    for (int i = z; i >= 0; i--) {
      int l = seg3[i].FindPre(x), r = seg3[i].FindSuf(x);
      ReDp(i, l, r);
    }
  } else {
    for (int i = z; i > y; i--) {
      int l = seg3[i].FindPre(x), r = seg3[i].FindSuf(x);
      seg3[i].Update(x);
      if (l < x) {
        ReDp(i, l, x - 1);
      } else {  // 删去 x 处的 Dp 值
        for (int j = 0; j <= i; j++) {
          f[i][x][j] = 1;
        }
        seg1[i].Update(x);
      }
      if (r > x) {
        ReDp(i, x + 1, r);
      }
    }
    for (int i = y; i >= 0; i--) {
      int l = seg3[i].FindPre(x), r = seg3[i].FindSuf(x);
      ReDp(i, l, r);
    }
  }
}

int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i], a[i]--;
  }
  Init(), Dp();
  for (int i = 1, x, y; i <= q; i++) {
    cin >> x >> y, y--;
    Change(x, y);
    cout << f[0][1][0] << '\n';
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3 2
1 3 1
3 2
1 3

output:

5
14

result:

ok 2 tokens

Test #2:

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

input:

6 8 1
3 8 7 7 1 6
1 4

output:

2100

result:

ok "2100"

Test #3:

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

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: 3ms
memory: 52856kb

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: 0ms
memory: 83624kb

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: 4ms
memory: 89832kb

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: 0ms
memory: 57020kb

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: 0ms
memory: 52824kb

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: 3ms
memory: 89804kb

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: 3ms
memory: 73384kb

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: 0ms
memory: 95836kb

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: 0ms
memory: 93800kb

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: 0ms
memory: 103980kb

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: 7ms
memory: 95828kb

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: 0ms
memory: 97920kb

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: 4ms
memory: 102012kb

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: 0ms
memory: 95804kb

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: 0ms
memory: 20112kb

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: 0ms
memory: 17980kb

input:

1 1 1
1
1 1

output:

1

result:

ok "1"

Test #20:

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

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: 0ms
memory: 104008kb

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: 3ms
memory: 100028kb

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: 6ms
memory: 44848kb

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: 8ms
memory: 180096kb

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: 75ms
memory: 274324kb

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: 19ms
memory: 170072kb

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: 7ms
memory: 87704kb

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: 7ms
memory: 112304kb

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: 16ms
memory: 167760kb

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: 64ms
memory: 293040kb

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: 59ms
memory: 292396kb

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: 52ms
memory: 293480kb

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: 59ms
memory: 293092kb

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: 62ms
memory: 294088kb

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: 47ms
memory: 293264kb

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: 60ms
memory: 287736kb

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: 0ms
memory: 34772kb

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: 48ms
memory: 296224kb

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: 296180kb

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: 54ms
memory: 293512kb

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: 26ms
memory: 293832kb

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: 32ms
memory: 292316kb

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: 76ms
memory: 300024kb

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: 80ms
memory: 299836kb

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: 68ms
memory: 300864kb

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: 31ms
memory: 300604kb

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: 20ms
memory: 302348kb

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: 63ms
memory: 301104kb

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: 32ms
memory: 299496kb

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: 27ms
memory: 302968kb

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: 119ms
memory: 208948kb

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: 168ms
memory: 172488kb

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: 163ms
memory: 151916kb

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: 64ms
memory: 212904kb

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: 186ms
memory: 266616kb

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: 148ms
memory: 251664kb

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: 12ms
memory: 36592kb

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: 602ms
memory: 294636kb

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: 559ms
memory: 301104kb

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: 551ms
memory: 301496kb

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: 543ms
memory: 301552kb

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: 580ms
memory: 302964kb

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: 550ms
memory: 301260kb

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: 576ms
memory: 301532kb

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: 16ms
memory: 301328kb

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: 38ms
memory: 300872kb

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: 24ms
memory: 300924kb

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: 453ms
memory: 301496kb

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: 450ms
memory: 300852kb

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: 433ms
memory: 300980kb

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: 915ms
memory: 301072kb

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: 883ms
memory: 300908kb

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: 915ms
memory: 300724kb

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: 723ms
memory: 303056kb

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: 739ms
memory: 301156kb

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: 741ms
memory: 300872kb

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: 620ms
memory: 300876kb

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: 620ms
memory: 301080kb

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: 619ms
memory: 300708kb

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: 4ms
memory: 36812kb

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