QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#773071#9317. Rivalshos_lyric#AC ✓289ms64220kbC++146.4kb2024-11-23 00:35:352024-11-23 00:35:36

Judging History

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

  • [2024-11-23 00:35:36]
  • 评测
  • 测评结果:AC
  • 用时:289ms
  • 内存:64220kb
  • [2024-11-23 00:35:35]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")

////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;

constexpr int LIM_INV = 9010;
Mint inv[LIM_INV], fac[LIM_INV], invFac[LIM_INV];

void prepare() {
  inv[1] = 1;
  for (int i = 2; i < LIM_INV; ++i) {
    inv[i] = -((Mint::M / i) * inv[Mint::M % i]);
  }
  fac[0] = invFac[0] = 1;
  for (int i = 1; i < LIM_INV; ++i) {
    fac[i] = fac[i - 1] * i;
    invFac[i] = invFac[i - 1] * inv[i];
  }
}


int N, C;
vector<int> A;

/*
  [i & 1][s][k][r][l]
    s: has last attack
    k: # real attack
    exp(rx) x^l
*/
Mint dp[2][2][310][40][310];

int main() {
  prepare();
  
  for (; ~scanf("%d%d", &N, &C); ) {
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%d", &A[i]);
    }
    
    vector<int> ASum(N + 1, 0);
    for (int i = 0; i < N; ++i) ASum[i + 1] = ASum[i] + A[i];
    
    memset(dp, 0, sizeof(dp));
    dp[0][0][0][0][0] = 1;
    for (int i = 0; i < N; ++i) {
      auto crt = dp[i & 1], nxt = dp[(i + 1) & 1];
      for (int s = 0; s < 2; ++s) for (int k = 0; k <= ASum[i + 1]; ++k) for (int r = 0; r <= i + 1; ++r) for (int l = 0; l <= ASum[i + 1]; ++l) nxt[s][k][r][l] = 0;
      for (int s = 0; s < 2; ++s) for (int k = 0; k <= ASum[i]; ++k) for (int r = 0; r <= i; ++r) for (int l = 0; l <= ASum[i]; ++l) {
        const Mint f = crt[s][k][r][l];
        if (f) {
          if (i >= C) {
            // x^b/b!
            for (int b = 0; b < A[i]; ++b) nxt[s][k + b][r][l + b] += f * invFac[b];
            // x^(b-1)/(b-1)!
            if (!s) for (int b = 1; b < A[i]; ++b) nxt[1][k + b][r][l + (b - 1)] += f * invFac[b - 1];
          }
          // exp(x) - \sum[0<=b<a] x^b/b!
          nxt[s][k + A[i]][r + 1][l] += f;
          for (int b = 0; b < A[i]; ++b) nxt[s][k + A[i]][r][l + b] -= f * invFac[b];
          // x^(a-1)!/(a-1)!
          if (!s) nxt[1][k + A[i]][r][l + (A[i] - 1)] += f * invFac[A[i] - 1];
        }
      }
    }
    
    vector<Mint> ans(ASum[N] + 1, 0);
    for (int r = 0; r < N; ++r) for (int l = 0; l <= ASum[N]; ++l) {
      /*
        \sum[j>=0] (1/N)^(j+1) [x^j/j!] e^(rx) x^l  (j selections before last)
        = \sum[j>=l] (1/N)^(j+1) j^(fall l) r^(j-l)
        = N^-(l+1) \sum[j>=0] (r/N)^j (j+l)^(fall l)
        = N^-(l+1) l!/(1-r/N)^(l+1)
      */
      const Mint val = Mint(N).pow(-(l+1)) * fac[l] * Mint(1 - r * inv[N]).pow(-(l+1));
      for (int k = 1; k <= ASum[N]; ++k) {
// if(N<=5&&dp[N & 1][1][k][r][l])cerr<<k<<" "<<r<<" "<<l<<": "<<dp[N & 1][1][k][r][l]<<" "<<val<<endl;
        ans[k] += dp[N & 1][1][k][r][l] * val;
      }
    }
    
    for (int k = 1; k <= ASum[N]; ++k) {
      if (k > 1) printf(" ");
      printf("%u", ans[k].x);
    }
    puts("");
  }
  return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 63932kb

input:

5 3
1 1 1 1 1

output:

0 0 299473306 199648871 1

result:

ok 5 tokens

Test #2:

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

input:

8 5
3 5 3 2 2 5 4 4

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 851829480 293319617 603094447 451112091 433952646 112377604 425219038 332689344 62257787 407546627 163509571 467949711 235335868 1

result:

ok 28 tokens

Test #3:

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

input:

30 17
1 8 9 3 2 6 6 9 5 9 1 2 1 3 3 1 1 5 7 1 2 5 5 7 3 3 4 7 5 6

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 447486792 435664782 192289330 927851817 610835375 240199921 954404690 368032120 126246490 646683498 959653535 111169893 486702262 177564172 129608751 316471586 15...

result:

ok 130 tokens

Test #4:

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

input:

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

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 175 tokens

Test #5:

score: 0
Accepted
time: 86ms
memory: 64200kb

input:

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

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 311496820 499666765 630363357 200815652 478731250 563563105 904410939 359168424 159921516 730782365 533649576 466554126 613409778 366032974 368023629 180857116 312368663 648502485 56431638 486226992 358007354 6...

result:

ok 167 tokens

Test #6:

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

input:

30 27
10 4 3 9 2 2 5 2 10 7 2 6 7 5 6 5 6 7 9 5 8 8 5 6 4 7 3 7 8 10

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 178 tokens

Test #7:

score: 0
Accepted
time: 108ms
memory: 64204kb

input:

30 3
4 9 4 5 10 8 6 10 4 6 4 6 2 2 5 4 2 6 6 8 9 9 4 5 5 2 8 4 8 10

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 551627658 476758103 20713911 713661666 289585584 661351456 949896193 135296607 800281711 316368950 365875349 754011197 764188129 358123873 682559259 996711429 117612995 254713355 916779199 653868710 36434508 631499492 596522864 765406164 292607513 883610913 347046723 ...

result:

ok 175 tokens

Test #8:

score: 0
Accepted
time: 27ms
memory: 64196kb

input:

30 27
2 10 4 9 5 6 9 4 5 2 7 5 8 5 5 6 9 6 10 6 3 6 8 8 5 8 9 7 2 5

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 184 tokens

Test #9:

score: 0
Accepted
time: 93ms
memory: 63932kb

input:

30 1
5 7 6 6 3 4 5 4 3 4 10 6 4 4 4 3 6 5 6 4 5 10 5 10 8 3 10 8 8 7

output:

0 0 0 0 382782877 70037351 959915161 218622398 248509455 139984326 256819542 406888868 965183760 752781498 624493330 609556130 412499423 477282458 956054367 310640551 782555851 419457807 892978125 232701409 799777023 768536441 819211398 713808031 531781933 627712700 575014071 258363792 682704840 864...

result:

ok 173 tokens

Test #10:

score: 0
Accepted
time: 34ms
memory: 63928kb

input:

30 24
5 3 6 8 6 8 9 6 7 4 3 4 8 9 5 4 5 3 4 8 8 10 9 3 5 7 10 9 4 7

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 234828639 87...

result:

ok 187 tokens

Test #11:

score: 0
Accepted
time: 148ms
memory: 63936kb

input:

30 6
3 3 8 6 4 8 10 6 3 6 4 3 10 6 9 10 3 9 10 8 8 3 7 10 9 9 7 4 8 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 319892531 68430074 910198666 121268889 171669007 711189879 771790292 326409722 18272281 902397744 180033684 192241313 185136257 793039882 782650786 791643453 875820452 262188156 103150416 604650668 708171740 93125131 708895592 140273579 7...

result:

ok 202 tokens

Test #12:

score: 0
Accepted
time: 152ms
memory: 63932kb

input:

30 5
7 9 10 5 4 7 9 4 6 10 4 10 6 4 4 10 9 4 6 5 8 8 10 10 7 9 10 4 5 7

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 811266735 618056498 797849613 182676338 207956047 57079934 590529409 25963140 115687367 372946288 587249452 451588512 390683822 743109044 718754565 295996422 75798614 85395425 685713518 588385389 44884495 119856368 116030099 5327317...

result:

ok 211 tokens

Test #13:

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

input:

30 24
8 5 10 9 10 10 5 10 9 7 9 8 8 9 9 8 6 9 6 4 8 6 10 4 9 9 7 6 7 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 233 tokens

Test #14:

score: 0
Accepted
time: 77ms
memory: 64200kb

input:

30 16
10 9 8 10 6 4 5 6 5 10 5 7 6 6 6 7 7 5 8 9 7 6 5 7 10 4 5 8 5 5

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 741215437 674604005 362402114 554911338 873897763 513722379 445027498 263555975 13...

result:

ok 201 tokens

Test #15:

score: 0
Accepted
time: 42ms
memory: 64204kb

input:

30 26
9 6 8 5 5 7 9 6 10 8 5 6 9 6 9 5 6 6 10 10 5 6 8 9 8 10 10 9 7 6

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 223 tokens

Test #16:

score: 0
Accepted
time: 149ms
memory: 63964kb

input:

30 7
6 8 5 8 6 5 5 7 9 6 5 9 8 5 10 5 10 10 9 8 6 5 8 9 8 5 9 6 7 6

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 120014486 387528422 900687061 367179564 725919234 839181478 168026598 76267256 248308001 742564647 606523209 188147390 24678933 85523200 529677524 646577608 154473150 544131238 252260853 355196669 669267589 597554021...

result:

ok 213 tokens

Test #17:

score: 0
Accepted
time: 145ms
memory: 63928kb

input:

30 9
6 8 10 6 10 5 9 9 7 8 5 8 6 8 8 5 10 7 5 10 9 5 8 10 5 10 6 5 7 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 52185470 137583355 808616284 161088504 559671658 77973461 828436413 695100926 590157749 765398276 457842001 164834230 435815043 218421346 198837133 186034109 2464...

result:

ok 223 tokens

Test #18:

score: 0
Accepted
time: 87ms
memory: 63924kb

input:

30 20
6 8 8 10 7 6 10 10 7 9 6 9 8 10 8 7 10 6 10 9 7 10 8 9 8 6 7 6 9 7

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 241 tokens

Test #19:

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

input:

30 3
8 9 8 7 9 6 7 7 9 6 6 9 6 10 6 10 10 9 9 7 10 8 8 8 6 7 9 6 7 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 195627681 146543243 545084188 538685335 178451565 100436201 580123887 751418583 418816374 345428930 847802885 115087636 408769973 170951560 561578742 607219571 880487956 918062657 618053645 427041436 741510184 451779117 262757043 134070326 261442241 21...

result:

ok 235 tokens

Test #20:

score: 0
Accepted
time: 131ms
memory: 63928kb

input:

30 18
10 10 10 10 10 10 9 6 9 9 10 7 9 8 6 9 10 6 10 7 9 9 9 9 8 10 10 9 7 6

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 261 tokens

Test #21:

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

input:

30 2
10 8 9 9 7 7 10 7 9 7 7 8 10 9 8 8 10 9 7 7 8 10 7 7 10 7 8 8 8 10

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 559190402 590909428 277036637 957034433 989793942 9210686 634172879 526230344 709529805 893863736 569125798 164424607 877281061 328188027 636906769 744002892 792495178 265477808 316703740 530414448 576387299 37808344 582705830 929136756 725579948 21743034 745713779 ...

result:

ok 249 tokens

Test #22:

score: 0
Accepted
time: 203ms
memory: 63928kb

input:

30 7
9 8 9 8 9 10 10 7 10 8 10 8 7 9 7 7 8 10 10 7 7 9 7 10 7 9 10 7 8 7

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 894396662 32606647 847488151 672568142 396431552 18592253 496101956 797327389 553083927 929386416 309685402 728511545 358757451 510115161 914478605 789205363 831958008 12436520...

result:

ok 252 tokens

Test #23:

score: 0
Accepted
time: 155ms
memory: 63964kb

input:

30 16
9 10 7 10 10 8 9 7 8 9 7 7 7 8 7 9 10 8 8 7 10 10 10 10 7 8 10 9 8 10

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 751824431 537425942 853408085 28877066...

result:

ok 257 tokens

Test #24:

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

input:

30 29
8 10 8 10 8 8 10 9 9 10 10 10 9 8 9 8 8 9 9 8 8 9 9 10 9 10 10 9 10 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 270 tokens

Test #25:

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

input:

30 27
10 9 9 8 8 8 8 9 8 8 8 10 9 9 8 9 8 9 10 9 10 8 8 9 9 9 9 8 9 9

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 262 tokens

Test #26:

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

input:

30 10
10 9 8 10 9 10 8 10 8 8 8 8 10 9 10 10 9 8 9 8 9 9 8 8 8 10 9 8 10 8

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 708567150 824663493 976594397 138161071 562314120 294566307 300891204 848596426 490814883 97617704 574767639 525764274 479...

result:

ok 266 tokens

Test #27:

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

input:

30 13
9 10 10 10 9 10 9 9 9 10 10 10 10 9 10 10 9 10 10 10 9 10 10 10 9 10 9 9 9 9

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 567784354 577039244 626009358 123914333 607022074 25...

result:

ok 287 tokens

Test #28:

score: 0
Accepted
time: 106ms
memory: 63996kb

input:

30 22
9 10 9 9 9 9 9 10 9 10 9 9 9 10 10 10 10 10 10 9 10 10 10 9 10 9 10 10 10 10

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 287 tokens

Test #29:

score: 0
Accepted
time: 60ms
memory: 64220kb

input:

30 26
10 9 9 9 10 10 9 9 9 10 9 10 10 10 10 10 10 10 10 9 9 10 9 9 9 9 10 10 9 9

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 285 tokens

Test #30:

score: 0
Accepted
time: 145ms
memory: 63968kb

input:

30 20
10 10 10 10 10 10 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:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 300 tokens

Test #31:

score: 0
Accepted
time: 289ms
memory: 64208kb

input:

30 9
10 10 10 10 10 10 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:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 492210536 498259261 557229146 875267115 985435937 209446446 176766370 453884819 488532245 417980453 420676331 240576557 95...

result:

ok 300 tokens

Test #32:

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

input:

30 26
10 10 10 10 10 10 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:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok 300 tokens

Extra Test:

score: 0
Extra Test Passed