QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#290473#4840. Noodleucup-team087#AC ✓834ms42500kbC++1413.6kb2023-12-25 01:57:022023-12-25 01:57:02

Judging History

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

  • [2023-12-25 01:57:02]
  • 评测
  • 测评结果:AC
  • 用时:834ms
  • 内存:42500kb
  • [2023-12-25 01:57:02]
  • 提交

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 <map>
#include <numeric>
#include <queue>
#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; }


////////////////////////////////////////////////////////////////////////////////
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;
}
////////////////////////////////////////////////////////////////////////////////

/*
  N >>= E;
  N = 7:
        b-a     c-b     d-c c-d     b-c     a-b       
  [  a   ][  b   ][  c   ][d ][  c   ][  b   ][  a   ]
  [ a+d  ][ a+c  ][ b+c  ][2b][ b+c  ][ a+c  ][ a+d  ]
        c-d     b-a     b-c c-b     a-b     d-c       
  
  d[i] := a[i] - a[i-1]
  2^k S = N a[0] + (N-1) d[1] + ... + 1 d[N-1]
  a[X] = a[0] + d[1] + ... + d[X]
       = 2^k S / N + (1/N) d[1] + ... + (X/N) d[X]
                   + ((X+1)/N - 1) d[X+1] + ... + ((N-1)/N - 1) d[N-1]
*/

int N, X;
Int Ans;

#ifdef LOCAL
constexpr int SMALL=100;
Mint brt[SMALL];
#endif

int E;
Mint small[40];
Mint invTwoHead, invN, S;
int fsLen;
vector<Mint> fs;

constexpr int LIM_TWO = 1 << 16;
Mint baby[LIM_TWO + 1], giant[LIM_TWO];
void prepareInvTwo() {
  baby[0] = 1;
  baby[1] = Mint(2).inv();
  for (int i = 2; i <= LIM_TWO; ++i) baby[i] = baby[i - 1] * baby[1];
  giant[0] = 1;
  for (int i = 1; i < LIM_TWO; ++i) giant[i] = giant[i - 1] * baby[LIM_TWO];
}
Mint invTwo(Int e) {
  e %= (MO - 1);
  return baby[e & (LIM_TWO - 1)] * giant[e >> 16];
}

void Init(int X_, const vector<int> &A_) {
  prepareInvTwo();
  
  N = (int)A_.size() - 1;
  X = X_ - 1;
  vector<Mint> A(N);
  for (int i = 0; i < N; ++i) {
    A[i] = A_[i + 1];
  }
  Ans = 0;
// cerr<<"N = "<<N<<", X = "<<X<<", A = "<<A<<endl;
  
#ifdef LOCAL
auto as=A;
for(int k=0;k<SMALL;++k){
 brt[k]=as[X];
 vector<Mint>aas(N);
 for(int i=0;i<N;++i)aas[i]=(as[i/2]+as[N-1-i/2])/2;
 as=aas;
}
#endif
  
  E = __builtin_ctz(N);
  for (int e = 0; e < E + 1; ++e) {
    small[e] = A[X];
    vector<Mint> AA(N);
    for (int i = 0; i < N; ++i) {
      AA[i] = A[i / 2] + A[N - 1 - i / 2];
    }
    A = AA;
  }
// cerr<<"E+1 = "<<E+1<<", A = "<<A<<endl;
  N >>= E;
  X >>= (E + 1);
// cerr<<"N = "<<N<<", X = "<<X<<endl;
  
  invTwoHead = Mint(1 << (E + 1)).inv();
  invN = Mint(N).inv();
  S = 0;
  for (int i = 0; i < N; ++i) {
    S += A[i << E];
  }
  vector<Mint> coef(N, 0);
  for (int i = 1; i <= X; ++i) coef[i] = i * invN;
  for (int i = X + 1; i < N; ++i) coef[i] = i * invN - 1;
  vector<Mint> diffs(N, 0);
  for (int i = 1; i <= (N - 1) / 2; ++i) {
    diffs[i] = A[i << (E + 1)] - A[(i - 1) << (E + 1)];
    diffs[N - i] = -diffs[i];
  }
// cerr<<"coef = "<<coef<<", diffs = "<<diffs<<endl;
  
  vector<vector<Mint>> gss;
  vector<int> vis(N, 0);
  for (int u = 1; u < N; ++u) if (!vis[u]) {
    vector<int> cyc;
    for (int v = u; !vis[v]; v = (2 * v) % N) {
      vis[v] = 1;
      cyc.push_back(v);
    }
    const int len = cyc.size();
// cerr<<"cyc = "<<cyc<<endl;
    vector<Mint> cs(len), ds(len);
    for (int j = 0; j < len; ++j) {
      cs[j] = coef[cyc[j]];
      ds[j] = diffs[cyc[len - 1 - j]];
    }
    const auto prod = convolve(cs, ds);
    vector<Mint> gs(len, 0);
    for (int i = 0; i < (int)prod.size(); ++i) gs[(i + 1) % len] += prod[i];
    gss.push_back(gs);
  }
  sort(gss.begin(), gss.end(), [&](const vector<Mint> &gs0, const vector<Mint> &gs1) -> bool {
    return (gs0.size() > gs1.size());
  });
  fsLen = (!gss.empty()) ? gss[0].size() : 1;
  fs.assign(fsLen, 0);
  for (int j = 0, k = 0; j < (int)gss.size(); j = k) {
    const int len = gss[j].size();
    assert(fsLen % len == 0);
    vector<Mint> sum(len, 0);
    for (k = j; k < (int)gss.size() && gss[j].size() == gss[k].size(); ++k) {
      for (int l = 0; l < len; ++l) {
        sum[l] += gss[k][l];
      }
    }
    for (int l = 0; l < fsLen; ++l) {
      fs[l] += sum[l % len];
    }
  }
}
void Query(Int id, Int K) {
  Mint ans = 0;
  if (K < E + 1) {
    ans = invTwo(K) * small[K];
  } else {
    ans += invTwoHead * S * invN;
    ans += invTwo(K) * fs[(K - (E + 1)) % fsLen];
  }
  Ans ^= (Int)ans.x * id;
// cerr<<"Query "<<K<<" = "<<ans<<endl;
#ifdef LOCAL
if(K<SMALL){
 if(brt[K]!=ans){
  cerr<<"Query "<<K<<": "<<brt[K]<<" "<<ans<<endl;
  assert(false);
 }
}
#endif
}
void Output() {
  printf("%lld\n", Ans);
}


unsigned long long rd (unsigned long long &x) {
x ^= (x << 13);
x ^= (x >> 7);
x ^= (x << 17);
return x;
}

int main () {
int test, T;
unsigned long long seed;
scanf("%d%d%llu", &test, &T, &seed);
for (int Case = 1; Case <= T; Case ++) {
int n, q, x;
long long k_max;
scanf("%d%d%d%lld", &n, &q, &x, &k_max);
vector<int> a(n + 1);
for (int i = 1; i <= n; i ++) {
scanf("%d", &a[i]);
}

Init(x, a);

for (int i = 1; i <= q; i ++) {
long long k = rd(seed) % k_max;
/*
Code your solution here.
*/

Query(i, k);

}

Output();

}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0 2 13
4 2 1 3
1 4 2 3
6 2 3 3
6 2 5 3 1 4

output:

5
499122191

result:

ok 2 number(s): "5 499122191"

Test #2:

score: 0
Accepted
time: 284ms
memory: 15368kb

input:

2 10 797319075708802836
113684 59509 60879 6
32638647 901977116 92769377 111313531 194556450 308920221 274948027 53839074 36789899 336414953 7822656 882018567 240889273 551036822 43894122 520299998 975663425 904073477 849285530 893849034 760289712 424634574 356841592 133728774 187333805 178888538 24...

output:

16239128126737
2816464973920
258796786805248
2842417876620
28235154198193
39877351371011
3727113223356
57118862773159
43987011744648
539849345237527

result:

ok 10 numbers

Test #3:

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

input:

3 3 1007443135116724023
1024 1000 1 1000000000000000000
477384376 909465555 252332338 772463085 19248489 477078929 490874096 590913773 186793419 86267013 157602316 885132049 535583733 232930882 527539546 357753245 624723319 209396835 552426720 228393578 646089605 527163938 344852177 283103198 382271...

output:

552595875816
677731572628992
431787015454720

result:

ok 3 number(s): "552595875816 677731572628992 431787015454720"

Test #4:

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

input:

4 2 800671710427981866
38 2 3 999999999999999995
481340812 180215320 309072846 723138322 343880508 163878107 709208703 989732204 455033487 652387964 618439500 974192650 592512909 303504660 859474596 158388326 981164518 497557067 810313157 585948548 150545857 936144876 668744662 798257298 442428457 8...

output:

1206687543
24480111343

result:

ok 2 number(s): "1206687543 24480111343"

Test #5:

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

input:

5 2 663829220961699585
54 132 45 1000000000000000000
466287074 22692455 416305815 32210418 134165221 955121939 249533809 206780128 159436055 730995548 286384049 948829222 468536656 830598600 765113681 156500310 407249267 870330675 951716408 926064147 547126024 69455630 816157011 402548334 921342672 ...

output:

87573055816
10519103074

result:

ok 2 number(s): "87573055816 10519103074"

Test #6:

score: 0
Accepted
time: 3ms
memory: 4216kb

input:

6 5 1035771710111639998
126 126 101 1000000000000000000
526639491 915990197 300023836 993188474 740043339 70919207 725045049 330903220 507477100 771430783 261280295 610229994 325313671 248776066 143349055 990220468 414046590 665062585 819517917 143860548 537951101 910353775 221421610 148621560 51332...

output:

71871106136
2151677960
3891295763
2331834843
343014358

result:

ok 5 number(s): "71871106136 2151677960 3891295763 2331834843 343014358"

Test #7:

score: 0
Accepted
time: 120ms
memory: 5352kb

input:

7 10 113538453654004954
98304 225864 15740 20
225572344 840912062 887114932 497094849 793974769 225137421 398712918 534479859 332585973 294648725 104422079 172008772 485943787 667788831 959886444 122438826 384093966 810851473 87957007 76546131 927126141 382507901 217203410 749104594 507261276 998085...

output:

33512225983571
3442379231392
1855638806581
319009171948829
122422603029446
50253169255146
47437245953788
40978960111440
387128730277430
88954081265798

result:

ok 10 numbers

Test #8:

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

input:

8 10 499892885021018451
402 400 401 1000000000000000000
733468082 283320503 889581393 719088520 724748058 50700534 738205698 743349659 272846871 697969133 890424840 792390153 648327183 504525983 234174437 716787674 560703813 197439638 950993466 526351228 19073598 41854498 632976886 902187848 7789020...

output:

271245752421
1559071842
8065086166
4467673656
705496576
563146450
4026601216
13478218412
10860130376
281666027

result:

ok 10 numbers

Test #9:

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

input:

9 10 760964392698787655
360 400 155 1000000000000000000
878567228 429864426 502442814 816253582 884577746 107142524 253364998 892630322 683693223 437027735 668771825 206685048 987212003 32906718 402237663 143647046 103046677 28212558 185954690 956773338 529269035 776219184 252791997 276530219 270405...

output:

34535923574
1612102883
33508494155
2148274288
2684354688
2052
4003034992
6710596581
887327329
2340617610

result:

ok 10 numbers

Test #10:

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

input:

10 10 301815535204274923
4002 1000000 2004 1000000000000000000
405028085 426909936 287753861 233130264 235499808 242974964 931338571 911432326 125912030 252420213 369713779 745651270 30702805 381362331 518038475 72365778 993923841 388284553 676360284 236253786 72468474 28251015 751888536 713652750 1...

output:

539808358562273
115694031258
59767460254
65581279905352
94033727578374
125080066144074
59181300521802
366829154807
84924905633826
286560153774791

result:

ok 10 numbers

Test #11:

score: 0
Accepted
time: 26ms
memory: 4252kb

input:

11 10 744748144426722705
3172 1000000 3172 1000000000000000000
215795636 571797538 606978281 868221006 211276231 454092799 568652298 451135038 151183121 273800753 391704274 290426096 462732440 729103194 503591293 51062232 713239142 699080416 474310050 648380748 884088504 726584428 940172101 30892507...

output:

297445272173202
9565174001
2788301222
46058741476919
303008669228327
277239253680522
12598786918213
120057151527217
1721195555576
29705581900190

result:

ok 10 numbers

Test #12:

score: 0
Accepted
time: 252ms
memory: 13020kb

input:

12 10 831032611264015628
506022 3 446975 999999999999999992
787063046 542404154 265678211 752346179 985076602 935086987 863193574 568731582 124073890 795000023 419380908 698670987 274631877 844385372 25745455 289647923 166102305 686444274 718125795 436697400 882056963 973802510 251991375 409550817 1...

output:

36705567
4101676923
970422640
7786305736
1354184846
320639815
627456828
2940816536
810740352
1444376791

result:

ok 10 numbers

Test #13:

score: 0
Accepted
time: 270ms
memory: 23088kb

input:

13 10 303546320941077082
47150 7 8044 999999999999999997
661766372 649091520 505189428 590802628 343084882 462909692 468008286 370775617 792275006 139824747 953244387 430589023 650703657 634363763 382188546 720654547 820349334 416528370 685163893 135994272 459160257 203782859 632943852 67768520 2435...

output:

4599523199
1747316681
1359336517
2461662702
1298278667
409987384
969128431
2195763137
1358928941
7706313449

result:

ok 10 numbers

Test #14:

score: 0
Accepted
time: 134ms
memory: 12272kb

input:

14 10 585445529812988936
439778 50000 288886 1000000000000000000
943516241 857621216 93163662 876878963 828586710 939629194 960201713 111516237 732196540 336650600 322377918 363211466 731981385 948185790 817789049 20817246 261730303 778314649 852695245 821933835 793027323 148665683 210395545 7940120...

output:

40893862325967
21129175375
2970200785794
1195463485672
544298073385
420924326602
277273231358
191857684238
115732601137
5384026098696

result:

ok 10 numbers

Test #15:

score: 0
Accepted
time: 128ms
memory: 12580kb

input:

15 10 950757049664878701
444446 50000 287889 1000000000000000000
821549421 900860542 369970894 548243623 743898839 773452738 791257586 804832675 4257915 340999321 595838652 955209440 240591685 951191350 539622745 562289877 586330936 217523617 579144615 709401600 81884110 437431745 352271396 13827118...

output:

14574344280122
9987781667
710691008092
4202225770728
3874106060419
4081467185058
2073027806157
1177043352681
4295594848966
2925608342929

result:

ok 10 numbers

Test #16:

score: 0
Accepted
time: 144ms
memory: 13236kb

input:

16 10 1036117599785704290
484846 50000 88881 1000000000000000000
646758235 654308890 75203760 891666136 667032065 204802745 965833810 15653010 961415565 757791006 665815929 662538296 55152432 692548376 295694149 326804675 370901475 954036573 726760293 820037765 10165523 860796167 477620289 659926873...

output:

28432133637078
7922519735
1597905039126
1485177941913
2279295470514
2895134927824
9458630449698
393100520412
174651751143
1923403290238

result:

ok 10 numbers

Test #17:

score: 0
Accepted
time: 517ms
memory: 33356kb

input:

17 10 382039605283796615
1777998 16000000 1777998 1000000000000000000
639234422 480509625 110276822 290821547 739795887 114706239 331149751 656493613 615185047 369244291 842554196 949381617 466009624 555992829 708464896 339770569 826905157 631462764 32454131 4508331 66317763 703393577 180076066 1635...

output:

15321892169337451
6612913714
80666002464113
962865684720393
7217609003067
748033711607733
55279055797001
530500008704004
2228909220926352
102223167466935

result:

ok 10 numbers

Test #18:

score: 0
Accepted
time: 532ms
memory: 41540kb

input:

18 10 1064282600105860446
1955554 16000000 1955554 1000000000000000000
473371066 938727372 747675835 987161654 589823178 242625839 719009997 837254678 78612638 681583126 591938808 472954373 246847872 450295080 158515470 433667924 909574969 668979690 958325411 53601699 162784205 872962148 867573352 3...

output:

16206388874986131
9001728506
102176753080404
126681752300814
8315345377931
143641367286211
519987978994108
793072985700323
57647936258182
176562988312118

result:

ok 10 numbers

Test #19:

score: 0
Accepted
time: 718ms
memory: 20532kb

input:

19 10 194693305249829040
1048578 42000000 1048578 1000000000000000000
335507781 742429448 702978382 946586449 14409629 978963188 970462119 914575270 550475986 882848404 601745799 291914073 268197141 77477933 111416037 777506783 10572795 346600096 975220479 247616481 138174157 991086067 708230277 562...

output:

63549186969097162
15850208489
9073091416
654966446375586
602315187402220
318904930273912
462247299492643
5530187311776
593775718270031
17077248571191

result:

ok 10 numbers

Test #20:

score: 0
Accepted
time: 834ms
memory: 42500kb

input:

20 10 243695405809544581
1999106 49999777 1999105 1000000000000000000
264012121 794288288 299439952 159048576 448267894 970604717 353338834 39848838 575417234 5190458 829704212 396974504 139181565 116245026 489839751 256473344 602927059 84404220 586992077 808733975 306085600 414578633 907641637 1606...

output:

68615061530020566
18668956956
26392150953
26376790790
40966650969
100348261
1080353222
3641019493
3133415213
535085963

result:

ok 10 numbers

Test #21:

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

input:

1 4 858308182826965649
44 252 21 493
351990194 107730355 138070770 477928061 982157465 205120193 467268937 234642423 310053019 775028129 269668690 542200428 975288085 302411733 293335676 748750294 795951112 917049691 832362148 13745124 157267113 549648632 613016356 853316479 280155963 304474782 6400...

output:

48279222532
135700644842
6492168379
69914278752

result:

ok 4 number(s): "48279222532 135700644842 6492168379 69914278752"

Test #22:

score: 0
Accepted
time: 17ms
memory: 4680kb

input:

0 5 1022005767888815898
9800 18947 7282 48
990388833 203351730 237061718 582960687 172572951 7287161 582955342 282867476 248571154 828818989 645737647 195804046 803898492 675702613 499145270 514992357 376035542 4314385 411271154 100979968 773932921 915142768 933045902 171297743 840007803 463183960 8...

output:

30651694485626
9159343191331
28759075652369
5417149171117
31001412844213

result:

ok 5 number(s): "30651694485626 9159343191331 2...69 5417149171117 31001412844213"

Test #23:

score: 0
Accepted
time: 589ms
memory: 15852kb

input:

0 1 998435630061439914
987524 50000000 173266 999999999999999991
662592087 349087330 661860514 904183227 541646728 142556504 249246104 542417784 840287030 381888883 702391420 54555598 649251720 799271623 283879677 210626812 252415284 918383364 893020661 92460067 158227094 906203155 103948362 1364734...

output:

53806487268229294

result:

ok 1 number(s): "53806487268229294"