QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355837#1097. 多项式复合hos_lyric100 ✓425ms41068kbC++1413.6kb2024-03-17 10:33:522024-03-17 15:20:41

Judging History

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

  • [2024-03-17 15:20:41]
  • 管理员手动重测本题所有提交记录
  • 测评结果:100
  • 用时:425ms
  • 内存:41068kb
  • [2024-03-17 10:33:52]
  • 评测
  • 测评结果:10
  • 用时:409ms
  • 内存:41160kb
  • [2024-03-17 10:33:52]
  • 提交

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 = 998244353U;
constexpr unsigned MO2 = 2U * MO;
constexpr int FFT_MAX = 23;
using Mint = ModInt<MO>;
constexpr Mint FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 911660635U, 372528824U, 929031873U, 452798380U, 922799308U, 781712469U, 476477967U, 166035806U, 258648936U, 584193783U, 63912897U, 350007156U, 666702199U, 968855178U, 629671588U, 24514907U, 996173970U, 363395222U, 565042129U, 733596141U, 267099868U, 15311432U};
constexpr Mint INV_FFT_ROOTS[FFT_MAX + 1] = {1U, 998244352U, 86583718U, 509520358U, 337190230U, 87557064U, 609441965U, 135236158U, 304459705U, 685443576U, 381598368U, 335559352U, 129292727U, 358024708U, 814576206U, 708402881U, 283043518U, 3707709U, 121392023U, 704923114U, 950391366U, 428961804U, 382752275U, 469870224U};
constexpr Mint FFT_RATIOS[FFT_MAX] = {911660635U, 509520358U, 369330050U, 332049552U, 983190778U, 123842337U, 238493703U, 975955924U, 603855026U, 856644456U, 131300601U, 842657263U, 730768835U, 942482514U, 806263778U, 151565301U, 510815449U, 503497456U, 743006876U, 741047443U, 56250497U, 867605899U};
constexpr Mint INV_FFT_RATIOS[FFT_MAX] = {86583718U, 372528824U, 373294451U, 645684063U, 112220581U, 692852209U, 155456985U, 797128860U, 90816748U, 860285882U, 927414960U, 354738543U, 109331171U, 293255632U, 535113200U, 308540755U, 121186627U, 608385704U, 438932459U, 359477183U, 824071951U, 103369235U};

// as[rev(i)] <- \sum_j \zeta^(ij) as[j]
void fft(Mint *as, int n) {
  assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
  int m = n;
  if (m >>= 1) {
    for (int i = 0; i < m; ++i) {
      const unsigned x = as[i + m].x;  // < MO
      as[i + m].x = as[i].x + MO - x;  // < 2 MO
      as[i].x += x;  // < 2 MO
    }
  }
  if (m >>= 1) {
    Mint prod = 1U;
    for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
      for (int i = i0; i < i0 + m; ++i) {
        const unsigned x = (prod * as[i + m]).x;  // < MO
        as[i + m].x = as[i].x + MO - x;  // < 3 MO
        as[i].x += x;  // < 3 MO
      }
      prod *= FFT_RATIOS[__builtin_ctz(++h)];
    }
  }
  for (; m; ) {
    if (m >>= 1) {
      Mint prod = 1U;
      for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
        for (int i = i0; i < i0 + m; ++i) {
          const unsigned x = (prod * as[i + m]).x;  // < MO
          as[i + m].x = as[i].x + MO - x;  // < 4 MO
          as[i].x += x;  // < 4 MO
        }
        prod *= FFT_RATIOS[__builtin_ctz(++h)];
      }
    }
    if (m >>= 1) {
      Mint prod = 1U;
      for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
        for (int i = i0; i < i0 + m; ++i) {
          const unsigned x = (prod * as[i + m]).x;  // < MO
          as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;  // < 2 MO
          as[i + m].x = as[i].x + MO - x;  // < 3 MO
          as[i].x += x;  // < 3 MO
        }
        prod *= FFT_RATIOS[__builtin_ctz(++h)];
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;  // < 2 MO
    as[i].x = (as[i].x >= MO) ? (as[i].x - MO) : as[i].x;  // < MO
  }
}

// as[i] <- (1/n) \sum_j \zeta^(-ij) as[rev(j)]
void invFft(Mint *as, int n) {
  assert(!(n & (n - 1))); assert(1 <= n); assert(n <= 1 << FFT_MAX);
  int m = 1;
  if (m < n >> 1) {
    Mint prod = 1U;
    for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
      for (int i = i0; i < i0 + m; ++i) {
        const unsigned long long y = as[i].x + MO - as[i + m].x;  // < 2 MO
        as[i].x += as[i + m].x;  // < 2 MO
        as[i + m].x = (prod.x * y) % MO;  // < MO
      }
      prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
    }
    m <<= 1;
  }
  for (; m < n >> 1; m <<= 1) {
    Mint prod = 1U;
    for (int h = 0, i0 = 0; i0 < n; i0 += (m << 1)) {
      for (int i = i0; i < i0 + (m >> 1); ++i) {
        const unsigned long long y = as[i].x + MO2 - as[i + m].x;  // < 4 MO
        as[i].x += as[i + m].x;  // < 4 MO
        as[i].x = (as[i].x >= MO2) ? (as[i].x - MO2) : as[i].x;  // < 2 MO
        as[i + m].x = (prod.x * y) % MO;  // < MO
      }
      for (int i = i0 + (m >> 1); i < i0 + m; ++i) {
        const unsigned long long y = as[i].x + MO - as[i + m].x;  // < 2 MO
        as[i].x += as[i + m].x;  // < 2 MO
        as[i + m].x = (prod.x * y) % MO;  // < MO
      }
      prod *= INV_FFT_RATIOS[__builtin_ctz(++h)];
    }
  }
  if (m < n) {
    for (int i = 0; i < m; ++i) {
      const unsigned y = as[i].x + MO2 - as[i + m].x;  // < 4 MO
      as[i].x += as[i + m].x;  // < 4 MO
      as[i + m].x = y;  // < 4 MO
    }
  }
  const Mint invN = Mint(n).inv();
  for (int i = 0; i < n; ++i) {
    as[i] *= invN;
  }
}

void fft(vector<Mint> &as) {
  fft(as.data(), as.size());
}
void invFft(vector<Mint> &as) {
  invFft(as.data(), as.size());
}

vector<Mint> convolve(vector<Mint> as, vector<Mint> bs) {
  if (as.empty() || bs.empty()) return {};
  const int len = as.size() + bs.size() - 1;
  int n = 1;
  for (; n < len; n <<= 1) {}
  as.resize(n); fft(as);
  bs.resize(n); fft(bs);
  for (int i = 0; i < n; ++i) as[i] *= bs[i];
  invFft(as);
  as.resize(len);
  return as;
}
vector<Mint> square(vector<Mint> as) {
  if (as.empty()) return {};
  const int len = as.size() + as.size() - 1;
  int n = 1;
  for (; n < len; n <<= 1) {}
  as.resize(n); fft(as);
  for (int i = 0; i < n; ++i) as[i] *= as[i];
  invFft(as);
  as.resize(len);
  return as;
}
////////////////////////////////////////////////////////////////////////////////

/*
  [0, n-1] * [0, n-m]
  
  [ a[0]                     ]
  [ ...    a[0]              ]
  [ a[m-1] ...               ]
  [        a[m-1]            ]
  [               ...        ]
  [                   a[0]   ]
  [                   ...    ]
  [                   a[m-1] ]
  
  computes (multiply by a)^T
  |as| = m, |bs| = n
  cs[k] = \sum[j-i=k] as[i] bs[j]  (0 <= k <= n-m)
*/
vector<Mint> middle(vector<Mint> as, vector<Mint> bs) {
  const int m = as.size();
  const int n = bs.size();
  assert(m <= n);
  int nn = 1;
  for (; nn < n; nn <<= 1) {}
  reverse(as.begin(), as.end());
  as.resize(nn, 0);
  fft(as);
  bs.resize(nn, 0);
  fft(bs);
  for (int i = 0; i < nn; ++i) bs[i] *= as[i];
  invFft(bs);
  bs.resize(n);
  bs.erase(bs.begin(), bs.begin() + (m - 1));
  return bs;
}


vector<vector<Mint>> mul(const vector<vector<Mint>> &ass, const vector<vector<Mint>> &bss) {
  const int m = ass.size();
  const int n = ass[0].size();
  assert((int)bss.size() == m);
  for (int i = 0; i < m; ++i) assert((int)ass[i].size() == n);
  for (int i = 0; i < m; ++i) assert((int)bss[i].size() == n);
  vector<Mint> as(m * (2*n-1), 0), bs(m * (2*n-1), 0);
  for (int i = 0; i < m; ++i) for (int j = 0; j < n; ++j) as[i * (2*n-1) + j] = ass[i][j];
  for (int i = 0; i < m; ++i) for (int j = 0; j < n; ++j) bs[i * (2*n-1) + j] = bss[i][j];
  const auto cs = convolve(as, bs);
  vector<vector<Mint>> css(2*m-1, vector<Mint>(2*n-1));
  for (int i = 0; i < 2*m-1; ++i) for (int j = 0; j < 2*n-1; ++j) css[i][j] = cs[i * (2*n-1) + j];
  return css;
}

/*
  a: deg n in x
  b: deg 2n in x (but zeros trimmed)
  css[i''][j''] = \sum[i'-i=i'', j'-j=j''] ass[i][j] bss[i'][j']
*/
vector<vector<Mint>> middle(int n, const vector<vector<Mint>> &ass, const vector<vector<Mint>> &bss) {
  const int ma = ass.size();
  const int mb = bss.size();
  assert(ma <= mb);
  for (int i = 0; i < ma; ++i) assert((int)ass[i].size() == n + 1);
  for (int i = 0; i < mb; ++i) assert((int)bss[i].size() == n + 1);
  vector<Mint> as(ma * (2*n+1) - n, 0), bs(mb * (2*n+1), 0);
  for (int i = 0; i < ma; ++i) for (int j = 0; j <= n; ++j) as[i * (2*n+1) + j] = ass[i][j];
  for (int i = 0; i < mb; ++i) for (int j = 0; j <= n; ++j) bs[i * (2*n+1) + j] = bss[i][j];
  const auto cs = middle(as, bs);
  vector<vector<Mint>> css(mb - ma + 1, vector<Mint>(n + 1));
  for (int i = 0; i <= mb - ma; ++i) for (int j = 0; j <= n; ++j) css[i][j] = cs[i * (2*n+1) + j];
  return css;
}

/*
  m: deg in t (numerator: m-1)
  n: deg in x
  (m + 1) * (n + 1) -> m * (n + 1)
*/
vector<vector<Mint>> comRec(int m, int n, const vector<Mint> &as, const vector<vector<Mint>> &qss) {
  assert((int)qss.size() == m + 1);
  for (int i = 0; i <= m; ++i) assert((int)qss[i].size() == n + 1);
  if (!n) {
    vector<vector<Mint>> ret(m, vector<Mint>(1));
    for (int i = 0; i < (int)as.size(); ++i) ret[i][0] = as[i];
    return ret;
  }
  auto negQss = qss;
  for (int i = 0; i <= m; ++i) for (int j = 1; j <= n; j += 2) negQss[i][j] = -negQss[i][j];
  auto qqss = mul(qss, negQss);
  for (int i = 0; i <= m << 1; ++i) {
    for (int j = 0; j <= n >> 1; ++j) qqss[i][j] = qqss[i][j << 1];
    qqss[i].resize((n >> 1) + 1);
  }
  const auto res = comRec(m << 1, n >> 1, as, qqss);
  vector<vector<Mint>> pss(m << 1, vector<Mint>(n + 1, 0));
  for (int i = 0; i < m << 1; ++i) for (int j = 0; j <= n >> 1; ++j) pss[i][j << 1 | (n & 1)] = res[i][j];
  const auto ret = middle(n, negQss, pss);
  assert((int)ret.size() == m);
  for (int i = 0; i < m; ++i) assert((int)ret[i].size() == n + 1);
  return ret;
}

/*
  a(b(x))
  transpose and rev: p(x) -> [x^(N-1)] p(x) b(x)^i for each i
  [x^(N-1)] p(x) / (1 - t b(x))
*/
vector<Mint> com(int n, const vector<Mint> &as, const vector<Mint> &bs) {
  assert((int)as.size() == n);
  assert((int)bs.size() == n);
  assert(!bs[0]);
  vector<vector<Mint>> qss(2, vector<Mint>(n, 0));
  qss[0][0] = 1;
  for (int j = 0; j < n; ++j) qss[1][j] = -bs[j];
  auto cs = comRec(1, n - 1, as, qss)[0];
  reverse(cs.begin(), cs.end());
  return cs;
}

int main() {
  int N;
  for (; ~scanf("%d", &N); ) {
    vector<Mint> A(N), B(N);
    for (int i = 0; i < N; ++i) scanf("%u", &A[i].x);
    for (int i = 0; i < N; ++i) scanf("%u", &B[i].x);
    const auto C = com(N, A, B);
    for (int i = 0; i < N; ++i) {
      if (i) printf(" ");
      printf("%u", C[i].x);
    }
    puts("");
  }
  return 0;
}

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

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3916kb

input:

10
471718462 333538257 428598195 612052692 590471745 944446044 697100922 914821505 821922667 796204008
0 664524145 888781513 683400052 974162045 247468747 989741728 584905990 907760865 369079177

output:

471718462 450427851 920673978 31507224 939163072 423696921 614211928 479123468 320195567 416460171

result:

ok 10 numbers

Test #2:

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

input:

7
0 684374077 431088245 957865188 211720052 720153445 838402227
0 83323602 472855233 798674987 236408696 910845333 668358271

output:

0 201833542 727937508 470386980 234588540 244772539 609427112

result:

ok 7 numbers

Test #3:

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

input:

5
0 0 0 926430687 477197726
0 802294496 680971493 681737032 749556382

output:

0 0 0 857373021 936578985

result:

ok 5 number(s): "0 0 0 857373021 936578985"

Test #4:

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

input:

5
889352683 753980171 811779018 939861293 908635381
0 165045270 354888858 761473396 470981514

output:

889352683 359024363 794685055 309901815 201881940

result:

ok 5 number(s): "889352683 359024363 794685055 309901815 201881940"

Test #5:

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

input:

7
383711513 669265521 573972493 239814715 215792592 407888551 173755023
0 365048877 95128213 847051833 488213101 839102642 702726864

output:

383711513 471244134 58474610 844679533 715078871 456918225 698346063

result:

ok 7 numbers

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #6:

score: 10
Accepted
time: 5ms
memory: 4448kb

input:

996
161511009 772392925 527939485 542218553 338989083 582119173 173588295 80449540 959120041 897659040 473538082 45227240 241624719 329177067 435794456 115169000 481193426 20227779 361780689 878926112 819776776 334133997 981198514 52714845 240225899 515376501 88088486 105460885 577642217 160168512 6...

output:

161511009 554792805 172694240 852577231 555117856 153853641 874017482 996621092 153503204 845474822 897579301 761021626 61087865 596170133 14024335 775168555 742636052 794086230 672461807 845953734 17556410 124288077 780015101 389190284 52537135 848640180 480617103 212179216 732860740 166625171 6703...

result:

ok 996 numbers

Test #7:

score: 0
Accepted
time: 5ms
memory: 4452kb

input:

1000
0 277446973 222477018 562372762 559187452 808077164 340320547 764480454 497260892 252359982 624278929 370993436 745575461 865646514 427718561 462482948 279411324 114504805 952349958 920521626 201132668 540312861 895525746 391072536 321657754 276408261 747845984 456209262 134679920 104118163 353...

output:

0 12576430 85753060 235121837 591477986 496778634 786531259 63161262 244092001 812978741 94076735 209708052 994578068 730343246 962468541 741101838 362062536 928314972 602574918 779700937 38265214 314757195 626753226 369697750 142590267 589788575 53681528 628736236 361287140 772388439 318642863 1628...

result:

ok 1000 numbers

Test #8:

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

input:

996
0 0 899863807 0 0 0 66611450 0 621660284 229392452 0 114929218 213148243 0 622681860 526290865 0 0 984015348 0 777791321 0 960210086 0 566282164 0 580179678 0 0 0 377710448 0 0 713418252 238234195 0 378144990 39431955 0 943472241 0 890148037 0 795020423 0 376174181 0 942794658 213397484 0 904373...

output:

0 0 292545861 723368331 161333978 425295970 253674673 291090070 957621737 103116132 206991363 776588764 526877379 801379641 457962536 769517369 843657758 330407396 236118741 370925167 670976612 888575235 339665638 789103965 515353978 692665919 25764019 214241125 724978206 854096197 550817751 7160263...

result:

ok 996 numbers

Test #9:

score: 0
Accepted
time: 5ms
memory: 4320kb

input:

999
12413875 961692467 138974991 420551777 487679284 136990575 654106539 694764042 926255523 373508697 862773382 734402187 550898927 152889848 678249614 365800464 945262965 271256429 734362649 531358447 847397195 303520819 967191050 677689493 98572348 476202173 474528284 495918007 3505740 619429447 ...

output:

12413875 733810412 871774407 798627440 901616460 971846934 732067745 343516455 101513337 57145486 543531542 601334423 573629170 465184494 377667145 530525631 340121493 44643192 413257832 344369187 971314160 57808936 363868779 67691026 50166625 922780634 821284020 867856985 646484317 478359072 308366...

result:

ok 999 numbers

Test #10:

score: 0
Accepted
time: 5ms
memory: 4312kb

input:

997
642743343 141194933 902705222 100497558 282346894 593598174 520270077 165149389 318204987 528020478 248477280 918477314 809862343 191841458 93393194 299270238 7530549 139543232 757326167 390149480 400052340 407059610 573119749 88245211 471201148 755947329 144359333 44400602 118310527 171035917 1...

output:

642743343 634979062 720088158 450116900 803576541 583603402 324275309 380593789 665978520 367826709 215330064 846013442 539309082 246006826 516577947 792605755 44436801 444994207 486903724 442288625 227707383 236583482 212177960 344990508 227342419 101392508 486976202 234046024 500983566 393886616 2...

result:

ok 997 numbers

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 10
Accepted
time: 10ms
memory: 5224kb

input:

2000
762547537 75173551 870113432 521599816 646951162 930226926 255857900 472720141 333846361 653818136 458821379 428420654 547070703 251487267 589580543 9039514 95858754 912595530 459934668 974612223 741868167 337915361 283998198 657838836 148680924 402494722 458383183 942526379 81034329 201705130 ...

output:

762547537 544975668 658219178 908486723 681804631 793627036 32468004 302413538 386878844 567794439 909897598 704830980 301193766 480765149 139289596 865504997 22128971 552622063 885762902 929162033 394510186 921652889 477936936 595615471 477367935 353537883 451408656 702681883 160112574 395484993 80...

result:

ok 2000 numbers

Test #12:

score: 0
Accepted
time: 10ms
memory: 5224kb

input:

1997
0 756244137 241625615 972273993 789067771 462713750 669489110 171971641 877838016 843036394 62307180 225019523 528278258 223909192 670128248 904843765 321522447 315611972 116083876 208300571 97648139 321729430 941111434 421902121 421925965 859573481 162750268 175327481 938997968 232967976 89547...

output:

0 210862827 833876032 981423918 601400394 786409493 553479674 69514367 248480084 411928143 37753677 767434169 762921012 4731274 713999974 776655797 200646208 752502307 692171907 610313143 451849483 849404190 408019661 111740155 216896841 228170638 712591959 545242690 393057599 417020975 200763852 93...

result:

ok 1997 numbers

Test #13:

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

input:

1998
937739875 0 984469091 834719118 524480388 0 0 0 0 321474422 127456071 2763625 0 753625170 0 0 0 592681384 683229618 0 58607696 559945174 0 0 0 0 734631510 0 728710162 986494391 985962307 688175625 0 0 0 902840491 0 231151820 0 0 0 0 0 0 566539278 0 0 0 22402304 881244958 46161044 0 590295765 0 ...

output:

937739875 0 698288431 509450668 406398191 836319322 953650131 134463435 210402643 682396383 212628803 939302016 775405943 509032017 194059279 38277976 75348160 275527227 832091865 882882327 753960847 932133110 57536822 109839024 714697344 283765173 867690720 754821377 67070942 260562851 712380016 91...

result:

ok 1998 numbers

Test #14:

score: 0
Accepted
time: 10ms
memory: 5028kb

input:

2000
508762352 907984984 362634808 581024297 33275312 291581208 969604438 261221864 870328695 809550515 386973351 48138895 239304853 946980716 915586556 281548978 94665516 813891731 329969243 417874695 116891471 141456970 259272224 223517646 375859501 130416172 756380445 290507901 855270327 12930121...

output:

508762352 310351789 594675347 868994744 674728035 77029763 490197156 872373373 506188988 423009465 444528750 83422917 947432922 786655600 779356378 470748506 645085511 444916601 579350221 240364676 198426441 192105842 282492919 48867980 137250338 718247336 205854859 120337623 489021049 837317283 370...

result:

ok 2000 numbers

Test #15:

score: 0
Accepted
time: 10ms
memory: 4904kb

input:

1995
514433164 336122184 911166742 743374710 614542871 770204663 493095979 120220857 990322077 602159180 200615140 873347426 779952898 227332497 962481335 474876037 661237965 338651306 906808625 276040195 223265932 930586488 390038881 336970376 858286545 232474385 352898994 335945999 766024417 83855...

output:

514433164 848324099 53795986 569155160 256768228 720486130 296040131 888867375 812226501 114336713 323748534 919995238 28193536 517464938 740761766 359663224 560233250 39238694 830969007 6273325 914015365 312089596 654496470 598494978 920092454 771093575 843378666 294398632 906192177 278383672 59937...

result:

ok 1995 numbers

Subtask #4:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #16:

score: 10
Accepted
time: 21ms
memory: 6132kb

input:

3998
153780345 548046997 261969995 40393235 951751104 331139085 381243144 228180885 680343474 808845193 68348429 826837928 413679719 379137805 876875176 67554537 573988748 964201426 244429043 953595410 410453108 878541630 512420075 327546613 480614660 818476778 692015530 429078829 990918460 76651831...

output:

153780345 656691227 362483197 955308186 776601724 628946215 914523621 990658462 415916087 840588822 60152003 729671464 294539731 915353243 186618984 726312119 596162672 5185193 340227909 810610052 330517227 563444550 972670836 86428606 584339761 104968500 621775144 529747361 582580167 946284001 4553...

result:

ok 3998 numbers

Test #17:

score: 0
Accepted
time: 18ms
memory: 6420kb

input:

3999
0 407485751 304499203 804421872 547913129 919610410 973164630 35767077 111771515 648923002 314478477 344667592 977226224 134626216 349386096 612586544 41245594 315869487 559302008 927227739 941081311 969035238 799393013 873396838 903944990 5808703 389845686 371791950 273989950 25353073 28784061...

output:

0 915329976 904834893 894756409 3125236 636491763 901910835 319054506 545184927 990862993 397159733 620371942 454838295 561652093 909333108 906344907 921531415 824932879 195839565 224213063 440854412 580503389 11496976 171937547 665065616 100521868 990263786 488001295 859038479 96881056 468701111 27...

result:

ok 3999 numbers

Test #18:

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

input:

3996
0 0 0 0 0 0 0 0 0 551500690 0 342229556 491434839 0 629535978 0 0 0 131546495 0 0 0 937607622 508865670 0 0 0 769690755 0 279493558 0 0 0 459678354 0 705467633 430688834 555657752 0 9772143 0 0 0 0 0 148155907 926506237 0 444461691 420117473 0 932647505 0 111489906 905397881 27971547 0 0 610710...

output:

0 0 0 0 0 0 0 0 0 18583988 47056775 465155258 610114004 798388043 419231181 810943915 496501659 952105526 211127912 550500311 485761905 984220335 30550544 613085754 26372009 59842703 318922736 552346733 794849704 193803457 91893155 130920918 787312064 856244409 283023784 838225523 515039073 44745164...

result:

ok 3996 numbers

Test #19:

score: 0
Accepted
time: 18ms
memory: 6148kb

input:

4000
488310616 193760594 992458981 269889148 968125443 882332151 533697026 854558991 201542685 819277067 993825650 632772810 616435725 447878084 134568557 388697257 709526232 719523445 507171148 979263605 251253249 801212088 145033685 489764404 817079013 550400417 774891639 608008130 830306796 61265...

output:

488310616 619429871 422151017 873823577 153333683 403517170 564393880 342399896 635571247 417799453 624594367 199601647 731721293 412715854 196078658 578222738 946788271 217883912 119075597 590467163 175619698 842086622 417970280 690500328 607225770 985949285 826375964 303384430 832459202 948262595 ...

result:

ok 4000 numbers

Test #20:

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

input:

4000
709761943 472359434 989434161 591107374 381888146 684077432 202920800 688689045 386355540 594684989 159226506 340904128 474133311 991605857 624372867 410149642 37582636 778341446 664416087 914282401 193050523 209800111 756789197 206374186 830129818 824966749 948935785 637221724 97609965 1873551...

output:

709761943 987213405 865612859 614865172 110351032 397755511 653446780 535267483 206110044 750765982 878616416 717135675 878949308 784582804 472100790 264997274 709857890 861382912 590023676 54136642 613053319 922356895 335060208 839609964 874851807 506571902 904418439 945205609 848751113 345017457 7...

result:

ok 4000 numbers

Subtask #5:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #21:

score: 10
Accepted
time: 42ms
memory: 8296kb

input:

6995
454642572 835955032 112422815 672775902 503351347 543443516 406283664 627384935 108780356 484058261 832887986 318471230 542936467 996295884 74454692 163298896 518248441 908997929 733676098 21524593 86144752 423268829 615877643 977545562 49001867 899471092 480787724 868909319 683871053 890446721...

output:

454642572 529416532 746982195 925615742 567285238 200008664 536397919 583571484 619350639 218773100 673272034 40740267 617944173 616311765 573897881 619043777 865788961 862337863 908343872 918295072 765217997 128570654 481514399 511627406 75769970 383397255 772012312 477365115 762915576 116487623 15...

result:

ok 6995 numbers

Test #22:

score: 0
Accepted
time: 37ms
memory: 8412kb

input:

6995
0 555419329 660618022 918450679 964714123 357422393 909927238 603839991 171641985 537982761 628019508 91418298 107188230 415492524 791339496 988953598 978755480 975540933 491831669 594342504 842615477 789839014 139770156 556757091 435595374 930719904 202699303 274809325 334891091 344710631 6822...

output:

0 586737595 246395455 268443495 490455374 478240499 957341911 979583290 503186638 418683045 630104748 290504820 795199313 575823637 304607817 54851076 750386466 483103741 452431733 114677727 875348869 706027081 934049234 352121236 395548728 113989943 74548697 991617596 938137418 150551198 813137083 ...

result:

ok 6995 numbers

Test #23:

score: 0
Accepted
time: 38ms
memory: 8348kb

input:

6999
0 0 713135780 697127007 0 730121781 0 361257380 0 80236225 338101617 696029493 0 0 0 0 328750817 960084451 0 213936824 686625100 480189053 0 109602233 0 0 219371049 0 0 511636511 0 504758575 0 0 0 279403658 448202911 390448603 508277801 0 0 0 417298174 60745225 415671805 727396990 884165389 615...

output:

0 0 748499966 422452049 760645615 897827950 701475181 21820755 955881538 711949096 578442771 889889837 321772207 889312139 691265873 67441817 672975076 944156681 133542813 816107169 916856142 658431060 283008011 889750448 307681671 854945160 580982017 493705125 200153759 526051122 556899424 65140003...

result:

ok 6999 numbers

Test #24:

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

input:

6996
149268686 2091296 208680928 818964534 632318080 189674573 874235861 542623431 294987837 446313686 131441922 389706031 341999355 437004783 232824838 631726797 868130630 303299522 301474926 779401407 628304977 432438587 557799992 916645333 865506196 944738008 38984219 902665237 404875733 40690941...

output:

149268686 413419433 972714001 754056380 232934639 239085486 195542032 103189041 789710872 303866074 38355230 901309250 121912279 833520563 77554225 283999656 690955821 678151567 383761889 605050587 368403460 351028715 404758429 267277871 164604076 597237781 81526725 682888586 2501333 491218511 24917...

result:

ok 6996 numbers

Test #25:

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

input:

7000
870190977 918933033 494544444 488338601 466715970 755647404 45213901 913175929 935595916 417209227 907393244 347762712 520167737 844677841 135324955 60880523 769387417 874098161 808621400 449609132 762412000 13932501 404606618 791243102 981059499 280315771 10447752 605144890 917196036 920793441...

output:

870190977 857811097 477234378 162288930 597063463 274775647 129901708 179492236 314161072 809683690 286183731 835351170 342083302 222047776 991212042 154944320 848408911 353289866 508875985 97945099 693613193 410302126 942538505 706934922 916213838 278437507 72464754 257458119 525375057 149884451 10...

result:

ok 7000 numbers

Subtask #6:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #26:

score: 10
Accepted
time: 80ms
memory: 11900kb

input:

9996
20001619 110841722 523720394 213614264 352869642 335861745 849125143 542917273 997508835 17427514 225400459 14110238 854525242 831009492 847852674 478035113 827457802 829299421 863186456 479143621 370918466 502292199 246880982 624076067 996015875 87825270 893942694 77966990 671595317 138111074 ...

output:

20001619 953886856 414777731 660023423 251228107 833674933 672126172 638683420 823755800 190127360 636661082 841836895 607641518 561838480 51959688 878509873 930998947 287266467 53386986 449661142 586317601 341680341 739607517 781321500 440609595 346026503 494670743 126952166 282187917 963502343 197...

result:

ok 9996 numbers

Test #27:

score: 0
Accepted
time: 76ms
memory: 12184kb

input:

9996
0 316806088 258631065 379268421 265800122 250665190 746025565 62971662 825395703 254711345 250096855 275676897 317689172 836900127 491426028 317671546 455997016 132418978 254646745 40903390 828604947 75957406 449687717 384817627 323983498 595137014 59888065 247042823 34046416 597355423 46602028...

output:

0 453783002 752988128 907937038 500263406 119237424 294583115 501790591 567340854 236639120 822313576 654518737 861301885 320879324 332097871 71083859 520225537 23783040 282150070 532744490 187320564 68408864 169231606 530212428 978998822 414010967 382018422 41219268 695335824 521372796 604358360 62...

result:

ok 9996 numbers

Test #28:

score: 0
Accepted
time: 78ms
memory: 11868kb

input:

9999
0 0 57013318 175176130 747452678 280675206 25012233 179821066 142553259 0 0 942481095 469884352 0 841991578 0 0 541845267 0 0 0 620620712 114109876 0 0 164550273 917297106 887243207 368496165 0 473500378 686748398 0 45937506 870318514 0 273371125 756348675 0 0 299898918 556297248 0 152884788 0 ...

output:

0 0 715507787 877855941 855828321 295001497 906063430 333489415 363068025 593689742 237318637 464773716 458122787 882411641 706365965 778103688 565214994 413964783 889090896 195873775 543097449 742455837 445766361 258688129 349761472 835587598 363465148 395521244 518305140 531170938 47484294 8963538...

result:

ok 9999 numbers

Test #29:

score: 0
Accepted
time: 80ms
memory: 12180kb

input:

9999
811958150 160430778 294847319 374924853 167178835 859936246 152104466 947722221 482162983 727433869 397923085 164154347 924644146 444842157 642006735 457353502 473743273 620339239 422718630 114256805 202459645 68124042 895686258 550551840 701122810 772080808 114126854 901610210 723300503 810093...

output:

811958150 596453378 695586022 615742668 835324187 462144540 354269142 393489101 576325476 599566194 177134047 919375474 62443702 823160909 335276911 26005788 405413097 718038856 927490380 46466471 863411891 42109456 343547239 304608309 872770004 99663900 512111156 641071519 730128634 939176246 85784...

result:

ok 9999 numbers

Test #30:

score: 0
Accepted
time: 76ms
memory: 11904kb

input:

10000
628289962 856800971 138238446 102557198 560911266 153136775 935060920 782799959 826121094 979531022 260558205 420565952 440381895 181007622 528040348 536447988 336134977 797713519 735630994 229727266 889357601 198071060 654863867 834094965 52591860 827047878 483276977 239637529 603564142 13281...

output:

628289962 272378477 471744247 610133128 986272199 877357303 863751491 119195630 279112660 332263377 871332328 72394677 67406383 589120352 12480421 720923336 651773989 484746984 429907796 946084485 366238534 429604340 411676321 807620542 149961913 324738411 438363966 216219807 32737680 417587405 4206...

result:

ok 10000 numbers

Subtask #7:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #31:

score: 10
Accepted
time: 92ms
memory: 13524kb

input:

14996
313671869 142593337 98088572 343100665 400680430 228292405 679652792 612073051 213769946 342209463 767566334 747882387 665219586 609137562 415035232 406621285 290657560 107108593 214916914 186784013 32135065 420377423 657373051 499367341 895251600 436272763 833263218 859822064 299163661 940617...

output:

313671869 208465987 72275132 310170747 343985644 445631954 997871681 923829714 538040851 536079708 483446930 718702548 229655445 350750669 579377826 870680116 906167257 238446505 974295710 577745488 697309605 556185572 923629417 410075581 351628002 425689363 963620070 857995616 777995991 790963225 8...

result:

ok 14996 numbers

Test #32:

score: 0
Accepted
time: 115ms
memory: 13448kb

input:

14997
0 664512888 314934688 404212356 34005 751297775 996834797 325806922 35478432 10652666 274002745 628549531 259977324 402769830 241972762 12187900 375371316 632973285 535070325 355649254 365941150 570218267 668338649 678503354 884450234 600918233 673616446 843858610 959004203 158911360 819810644...

output:

0 529309905 91595829 310060160 438905829 780703981 555626469 763389113 279422881 451994205 234825010 941344293 440772282 292506168 995921675 367082430 862585715 524881640 535745025 263210274 794551550 891999077 914062586 556331448 796417162 704962030 762123759 76572199 337995887 932370687 329196248 ...

result:

ok 14997 numbers

Test #33:

score: 0
Accepted
time: 90ms
memory: 13448kb

input:

14997
0 0 0 0 0 778796546 548675090 0 86890858 613001673 241685808 97185274 535074579 0 0 0 0 463794836 0 0 0 0 917809255 194465473 236394945 681027253 0 0 0 0 0 0 0 0 0 430601046 0 0 204120698 415758499 0 0 0 0 0 0 0 967737083 879758568 956409987 0 0 3533328 0 677732157 0 946056390 774084911 118780...

output:

0 0 0 0 0 754118056 481828018 623831310 465981015 776864671 983812656 333662833 541392912 351599879 854898994 91279495 262927457 851666418 235516740 617595389 953428472 163737222 767139843 750580338 45076893 196872535 818445319 507114657 300314329 885452887 767222721 211089822 372673857 322253386 17...

result:

ok 14997 numbers

Test #34:

score: 0
Accepted
time: 88ms
memory: 13440kb

input:

14997
231662012 638789053 211350613 619158687 218139531 552245374 484250327 614937102 605868465 627657673 110876795 816399501 795912827 734992258 120591705 669984752 770699523 650390215 394842640 703344410 743789772 942170771 845357056 568416527 684606372 763958947 812426375 650453789 411073969 5605...

output:

231662012 523750071 21957196 860934768 627395912 708318604 800193417 729399737 688749130 138751985 557757047 360048014 844581997 557318068 997088935 585589194 281076409 875689474 921984392 124002758 163224130 781814541 447896102 17016734 657019803 436354807 105458171 46943742 832684053 483670268 872...

result:

ok 14997 numbers

Test #35:

score: 0
Accepted
time: 95ms
memory: 13732kb

input:

15000
789343069 489095826 74030241 129800352 659865597 142067787 717036704 522364091 892158170 377815679 329146859 786902987 786034783 177666458 218953394 616099199 288059439 338946556 456605064 837467600 643393278 928041627 580980624 995849745 384369270 439848819 571266190 783142987 242250809 25522...

output:

789343069 796429706 638739142 184594471 781415346 10803458 243050777 514964643 511749635 184320762 472831182 447192882 764764239 751453484 340363006 643049951 187930076 239069072 720706916 609455562 886964350 688434679 391505726 612403381 496778331 597612287 282365037 190697512 387480116 448000202 7...

result:

ok 15000 numbers

Subtask #8:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Test #36:

score: 10
Accepted
time: 184ms
memory: 20616kb

input:

19998
85416712 84385345 754066567 243130561 532216458 105159737 707780937 775904445 853669095 199383593 842793447 742121835 564638740 335765175 322694866 282202200 314996330 611955545 739046429 340933190 711362655 553531254 91946179 698097147 849831747 555774924 643348797 926545732 937796044 7206333...

output:

85416712 590588585 482204663 626561208 18056661 737190236 537542765 183098516 728404016 433073423 678962121 688729859 136649872 418344477 755785641 56214811 621421407 560169707 720219388 602069774 688907601 415112636 964132263 474673313 255426691 731606791 556942273 163314743 731578732 763529995 836...

result:

ok 19998 numbers

Test #37:

score: 0
Accepted
time: 177ms
memory: 20424kb

input:

19999
0 858730701 671110906 515292006 738617480 928264174 624524958 761375352 660909219 114703214 470743321 455896322 629230553 85793257 810887288 822909257 109551068 760691577 456367669 206209591 952315165 225172555 833404527 218940853 615087007 81343449 847383688 812309715 352109059 181560574 5826...

output:

0 716333256 925858484 132147287 339175328 880179889 852974966 812167387 538074897 459677015 779975404 4643185 619961214 127995594 804068203 887668407 505728304 775817078 915794183 886769870 555674146 274487283 907576041 791112699 613828122 237483993 70811723 173066607 508221058 874766678 290111829 6...

result:

ok 19999 numbers

Test #38:

score: 0
Accepted
time: 171ms
memory: 20460kb

input:

19996
0 0 86914140 0 859898444 99577656 853618289 432171606 0 159845777 0 0 0 0 179464361 0 507902010 523079902 251605759 174852634 0 255972730 768088007 0 0 0 692632708 246847392 840437885 152823743 601053958 0 837398506 0 0 468701491 0 522566874 0 0 0 0 306704612 455357129 0 0 0 518518746 64946971...

output:

0 0 254065234 711888458 432408588 66369198 90860255 338025246 465384696 401378594 477638914 163092872 169982541 198569435 905479088 74406 504048850 642280801 353439915 668684815 573224324 205482545 528313177 738360767 383529816 875984379 463448637 260449150 28131559 714284677 363321146 581572464 461...

result:

ok 19996 numbers

Test #39:

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

input:

19998
480194831 927508468 92542502 124344821 164613543 311522141 38251945 644908338 8466817 69889059 673279950 31629370 6270004 658700747 88191275 192060331 163894414 970013871 708044439 228348278 981951543 861262983 347186981 684475357 905545156 182417965 324127325 888612892 109844715 742652451 143...

output:

480194831 872872867 840377305 385322497 864480157 34236241 358758242 12703952 516736306 551690932 928826500 187071325 985330773 893736600 948317005 992764171 539341601 637587059 586728702 212981955 125012013 379944898 875017282 194187547 964117674 937084848 699485321 495714907 68408688 591707437 549...

result:

ok 19998 numbers

Test #40:

score: 0
Accepted
time: 183ms
memory: 20660kb

input:

19997
621987939 485569375 306553634 35823028 587918806 954935650 889131117 610934554 506713343 282632364 66087857 318833355 297277574 496001485 880463018 654242906 247599822 639287009 519563663 976242972 146829588 576639549 400992691 416195231 172419055 493651694 11355385 704501176 119965092 7376796...

output:

621987939 898561495 487060795 115872079 93254715 931414914 389608667 601878487 824536341 131116807 327072508 273670944 932553776 30950137 450921522 724101388 702292264 143096374 191465046 77361918 431616446 768349905 905148801 837460171 454454478 203993947 895547823 944546208 318223564 40613310 1798...

result:

ok 19997 numbers

Subtask #9:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #41:

score: 10
Accepted
time: 201ms
memory: 23744kb

input:

29999
693276472 901746274 950451626 78176359 129821263 119286456 522706270 744871295 266804234 764837710 345641106 199294417 610445867 20706598 868540988 534935213 237213840 660913114 570739253 688187012 834074756 654351427 366436699 280808867 402268232 351298448 53105599 359222587 845270229 2067178...

output:

693276472 547293821 556135925 876208227 267646724 432528404 247258212 19578234 287971813 966600710 194418209 254489727 87574458 573186182 988226864 271530974 968321812 487988299 513766629 496876352 75206769 727762651 218034050 51898489 271711356 995635977 23808756 407505903 110403997 817623731 36713...

result:

ok 29999 numbers

Test #42:

score: 0
Accepted
time: 196ms
memory: 23944kb

input:

29999
0 556887689 399836746 877557670 232773072 121295080 68221660 647053811 929301518 575346751 119346151 330541219 139039753 125458339 75709323 610943677 236133642 226841876 618791546 336351445 481581052 952834736 556422767 111645160 81046453 708112824 612929032 128518231 247804278 76202152 510187...

output:

0 783557747 245639910 596987363 358845270 280023949 168488267 40068719 850727101 967513094 903245709 415259244 767852440 505750298 429351084 81094742 390454431 657423696 467514671 785496425 139862978 744371196 942457907 228718769 505868376 411338093 85068590 929780512 684069722 533481603 962754241 3...

result:

ok 29999 numbers

Test #43:

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

input:

29998
906914517 0 0 0 0 686825912 367232085 163158022 0 236071455 0 0 0 0 754927818 700689327 0 0 40951629 819890664 736337857 120191482 31698853 0 161459726 0 217232566 552566089 0 0 0 809045685 0 226196895 0 0 349614284 0 0 0 99323438 0 0 0 649007219 770142636 0 803275330 0 0 545581523 0 52308466 ...

output:

906914517 0 0 0 0 698765902 533105863 180288977 37597200 158878792 198730493 437861917 564630816 543677901 832399488 469375682 103398277 254427945 353725938 937565060 830425696 262860218 916952195 346898762 395627135 411738073 15598192 857172927 538061214 727642471 646368766 485418571 406980444 1431...

result:

ok 29998 numbers

Test #44:

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

input:

29997
418963792 8266789 670891869 68980399 855739942 307072632 334659553 438947197 410925095 965614270 108553233 902823116 184409835 550430191 27780329 118142104 245897950 333559108 538789567 125936886 39291148 806207179 48156532 964246042 204814916 929594003 328618986 615715724 646596373 2259495 30...

output:

418963792 214559406 699388463 970664794 556581543 994184340 656859175 814987947 335783962 657816756 845836523 824248873 16643562 588015043 877790299 196557996 976805102 950544 398059330 772705411 958524609 360489877 587090329 669531861 624987817 862367588 42209243 355811188 167012270 677195907 26685...

result:

ok 29997 numbers

Test #45:

score: 0
Accepted
time: 204ms
memory: 23756kb

input:

29998
364400155 739516817 162411446 231906004 462507987 211019865 751360189 887862656 484681062 71393677 400470905 734913095 738362090 580060254 783380503 121409411 632243718 349276236 296585496 311301263 574595654 344377724 454098129 860609267 891590933 302657383 167776530 312004606 185850223 85394...

output:

364400155 740301177 793942875 525812339 533093901 57481972 519653492 137307655 892818414 581708507 930416372 8378071 48293600 863278377 441583818 404449936 996421881 585149678 720966337 380181694 427053813 685070472 323322031 359534980 777824922 860644378 240588173 824767267 83736531 418700288 67750...

result:

ok 29998 numbers

Subtask #10:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Test #46:

score: 10
Accepted
time: 421ms
memory: 40956kb

input:

50000
545539715 894194162 42888701 403852523 639534861 753911087 563875603 278611217 19872203 493693757 901003209 881969090 221054788 66159258 323596917 933583818 606614889 519697064 318148448 149202663 565942655 464044762 839075530 462796820 465271770 51438234 370898891 254552061 296215373 29617851...

output:

545539715 352614899 388506376 552392478 442837132 373499517 339650931 197336612 820528744 512560955 351998837 35029568 699147667 130980802 556875525 444428204 792958687 373432628 9098821 569103223 226418716 638650368 456992025 460263543 860275644 760567927 80658194 10065568 282738187 853854006 66981...

result:

ok 50000 numbers

Test #47:

score: 0
Accepted
time: 425ms
memory: 40928kb

input:

50000
0 260576686 208710239 304057215 633042827 599376823 917610714 40927421 760860094 775749488 561222485 764717158 411699186 748023517 64781099 300819266 53101736 610493511 716998836 151790138 793963403 234403588 436733612 984983892 576110642 155263728 72284478 106327036 312984681 639376442 155095...

output:

0 925988565 922475681 671518668 195513919 732974121 867304562 493500997 117293953 201168320 679042100 503846175 26030543 402364819 443637870 211634939 991028656 692992478 771826239 943708473 479317902 943877115 293242269 48051662 784566438 668057856 399597240 242455508 647110040 897655798 940870605 ...

result:

ok 50000 numbers

Test #48:

score: 0
Accepted
time: 420ms
memory: 41040kb

input:

49996
46153737 0 572315932 612395037 0 94589801 914930515 0 552897236 430013088 0 0 241258933 374592203 446890387 561522556 115868825 550741271 941769332 837638168 599791317 421683736 0 161507146 937298210 678954725 248289499 279487801 438280794 0 324445395 0 0 685801959 359666517 630411709 0 178387...

output:

46153737 0 614084429 790810788 554262160 427656260 396218444 652735829 194546306 258505153 59858829 268880535 417122291 566889502 61273795 780777918 258568740 958638645 833811286 698442071 283645862 957850452 978375177 903292538 537870624 279159520 461456626 783943202 166633346 232071901 541518309 8...

result:

ok 49996 numbers

Test #49:

score: 0
Accepted
time: 414ms
memory: 40972kb

input:

50000
244000142 611794919 82111016 663159359 916243771 714090791 244594993 98389394 13181571 319640624 928603291 228913963 825642038 717710866 722301394 441244339 535675027 725851357 87442202 849319101 969518485 394989654 805197292 819494244 250439313 293027984 447860562 453903529 871494037 18061963...

output:

244000142 292099021 988644654 519203454 916631373 959995881 785394016 277638591 81121597 617344291 454384289 595737030 319290329 874518045 413299802 268964073 435296449 540219822 696793427 684745390 17511107 347492375 146432139 902514021 433468689 491318747 35277409 949365740 761877409 397628461 148...

result:

ok 50000 numbers

Test #50:

score: 0
Accepted
time: 420ms
memory: 41068kb

input:

50000
733111239 765093302 422979106 573466508 475218102 921869647 234526757 679911388 152169126 626774211 656459867 967421098 638418129 593400274 466878129 768175804 680708491 719933748 344566974 33186051 678117194 563040406 157791562 735325167 728262152 302737746 864407632 898246281 584923015 77626...

output:

733111239 151756854 1300504 274457499 452146169 99451155 4023179 883074378 343008738 552580064 817643061 60398528 58229181 165883234 296914064 660816981 993793946 12827406 735383992 736744484 890460979 61253229 512327059 121555219 485193490 858961577 621781471 214675624 382326118 757294987 631732968...

result:

ok 50000 numbers