QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335261#7899. Say Hello to the Futurehos_lyricAC ✓249ms65136kbC++149.6kb2024-02-23 03:47:152024-02-23 03:47:15

Judging History

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

  • [2024-02-23 03:47:15]
  • 评测
  • 测评结果:AC
  • 用时:249ms
  • 内存:65136kb
  • [2024-02-23 03:47:15]
  • 提交

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


int N;
vector<int> A;

void brute() {
  vector<Mint> dp(N + 1, 0);
  dp[0] = 1;
  for (int i = 0; i < N; ++i) {
    int mx = 0;
    for (int j = i + 1; j <= N; ++j) {
      chmax(mx, A[j - 1]);
      if (mx <= j - i) dp[j] += dp[i];
    }
  }
  cerr << A << ": " << dp << endl;
}

namespace easy {
vector<Mint> dp;
vector<int> mxs;
vector<char> on;
vector<vector<int>> iss;
void init() {
  dp.assign(N + 1, 0);
  dp[0] = 1;
  mxs.assign(N + 1, 0);
  on.assign(N + 1, 0);
  iss.assign(N + 1, {});
}
void rec(int l, int r) {
  if (l + 1 == r) {
    if (A[l] <= 1) dp[r] += dp[l];
  } else {
    // dp[l, mid) -> dp(mid, r]
    const int mid = (l + r) / 2;
    rec(l, mid);
    
    mxs[mid] = 2;
    for (int i = mid; --i >= l; ) mxs[i] = max(A[i], mxs[i + 1]);
    for (int j = mid; j < r; ++j) mxs[j + 1] = max(mxs[j], A[j]);
    /*
      condition for i->j: max{mxs[i], mxs[j]} <= j - i
        - mxs[i] <= j - i  <=>  i + mxs[i] <= j
        - mxs[j] <= j - i  <=>  i <= j - mxs[j]
        i + mxs[i], j - mxs[j]: almost decreasing
    */
    for (int j = mid + 1; j <= r; ++j) iss[j].clear();
    for (int i = l; i < mid; ++i) {
      on[i] = 0;
      if (i + mxs[i] <= r) iss[max(i + mxs[i], mid + 1)].push_back(i);
    }
    // valid: l <= i < k (<= mid)
    Mint now = 0;
    for (int k = l, j = mid + 1; j <= r; ++j) {
      for (const int i : iss[j]) {
        on[i] = 1;
        if (i < k) now += dp[i];
      }
      for (; k < mid && k <= j - mxs[j]; ++k) if (on[k]) now += dp[k];
      for (; k > l && !(k - 1 <= j - mxs[j]); --k) if (on[k - 1]) now -= dp[k - 1];
      dp[j] += now;
    }
    
    rec(mid, r);
  }
}
}  // easy

vector<Mint> pre, suf;

namespace hard {
vector<Mint> diff;
vector<int> mxs;
vector<pair<int, int>> mxss[2];
vector<char> on;
vector<vector<int>> jss, iss;
void init() {
  diff.assign(N, 0);
  mxs.assign(N + 1, 0);
  for (int s = 0; s < 2; ++s) mxss[s].assign(N + 1, make_pair(0, -1));
  on.assign(N + 1, 0);
  jss.assign(N + 1, {});
  iss.assign(N + 1, {});
}
void rec(int l, int r) {
  if (l + 1 == r) {
    if (A[l] > 1) diff[l] += pre[l] * suf[r];
  } else {
    /*
      diff[h] -= pre[i] suf[j]
        - l <= i < mid < j <= r
        - i <= h < j
        - max{mxs[i], mxs[j]} <= j - i
      diff[h] += pre[i] suf[j]
        - l <= i < mid < j <= r
        - i <= h < j
        - max{mxs'[h][i], mxs'[h][j]} <= j - i
            mxs'[h]: mxs when A[i] <- 1
            at most one h can change each mxs[i] or mxs[j]
    */
    const int mid = (l + r) / 2;
    rec(l, mid);
    
    mxss[0][mid] = mxss[1][mid] = make_pair(2, -1);
    for (int i = mid; --i >= l; ) {
      pair<int, int> tmp(A[i], i);
      for (int s = 0; s < 2; ++s) {
        mxss[s][i] = mxss[s][i + 1];
        if (mxss[s][i] < tmp) swap(mxss[s][i], tmp);
      }
    }
    for (int j = mid; j < r; ++j) {
      pair<int, int> tmp(A[j], j);
      for (int s = 0; s < 2; ++s) {
        mxss[s][j + 1] = mxss[s][j];
        if (mxss[s][j + 1] < tmp) swap(mxss[s][j + 1], tmp);
      }
    }
    // l <= h < mid
    for (int s = 0; s < 2; ++s) {
      for (int j = mid; j <= r; ++j) mxs[j] = mxss[0][j].first;
      for (int i = mid - 1; i >= l; --i) mxs[i] = mxss[s][i].first;
      for (int i = mid - 1; i >= l; --i) jss[i].clear();
      for (int j = r; j > mid; --j) {
        on[j] = 0;
        if (j - mxs[j] >= l) jss[min(j - mxs[j], mid - 1)].push_back(j);
      }
      // valid: (mid <=) k < j <= r
      Mint now = 0;
      for (int k = r, i = mid - 1; i >= l; --i) {
        for (const int j : jss[i]) {
          on[j] = 1;
          if (j > k) now += suf[j];
        }
        for (; k > mid && k >= i + mxs[i]; --k) if (on[k]) now += suf[k];
        for (; k < r && !(k + 1 >= i + mxs[i]); ++k) if (on[k + 1]) now -= suf[k + 1];
        const int h = mxss[0][i].second;
// if(l<=h&&h<mid)cerr<<"l="<<l<<", mid="<<mid<<", r="<<r<<", s="<<s<<", h="<<h<<", i="<<i<<": "<<pre[i]<<" * "<<now<<endl;
        if (l <= h && h < mid) diff[h] += (s?+1:-1) * pre[i] * now;
      }
    }
    // mid <= h < r
    for (int s = 0; s < 2; ++s) {
      for (int i = mid; i >= l; --i) mxs[i] = mxss[0][i].first;
      for (int j = mid + 1; j <= r; ++j) mxs[j] = mxss[s][j].first;
      for (int j = mid + 1; j <= r; ++j) iss[j].clear();
      for (int i = l; i < mid; ++i) {
        on[i] = 0;
        if (i + mxs[i] <= r) iss[max(i + mxs[i], mid + 1)].push_back(i);
      }
      // valid: l <= i < k (<= mid)
      Mint now = 0;
      for (int k = l, j = mid + 1; j <= r; ++j) {
        for (const int i : iss[j]) {
          on[i] = 1;
          if (i < k) now += pre[i];
        }
        for (; k < mid && k <= j - mxs[j]; ++k) if (on[k]) now += pre[k];
        for (; k > l && !(k - 1 <= j - mxs[j]); --k) if (on[k - 1]) now -= pre[k - 1];
        const int h = mxss[0][j].second;
// if(mid<=h&&h<r)cerr<<"l="<<l<<", mid="<<mid<<", r="<<r<<", s="<<s<<", h="<<h<<", j="<<j<<": "<<now<<" * "<<suf[j]<<endl;
        if (mid <= h && h < r) diff[h] += (s?+1:-1) * now * suf[j];
      }
    }
    
    rec(mid, r);
  }
}
}  // hard


int main() {
  for (; ~scanf("%d", &N); ) {
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%d", &A[i]);
    }
    
    {
      using namespace easy;
      init();
      rec(0, N);
      pre = dp;
#ifdef LOCAL
cerr<<"pre = "<<pre<<endl;brute();
#endif
      reverse(A.begin(), A.end());
      init();
      rec(0, N);
      suf = dp;
      reverse(suf.begin(), suf.end());
#ifdef LOCAL
cerr<<"suf = "<<suf<<endl;brute();
#endif
      reverse(A.begin(), A.end());
    }
    {
      using namespace hard;
      init();
      rec(0, N);
      for (int i = 0; i < N; ++i) {
        printf("%u\n", (pre[N] + diff[i]).x);
      }
#ifdef LOCAL
for(int i=0;i<N;++i){int a=1;swap(A[i],a);brute();swap(A[i],a);}
#endif
    }
  }
  return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3800kb

input:

5
1 3 2 1 2

output:

3
6
3
3
6

result:

ok 5 tokens

Test #2:

score: 0
Accepted
time: 165ms
memory: 47992kb

input:

200000
15922 15391 11782 4758 1973 19909 16800 6438 3821 986 18599 2011 338 19886 12401 4169 11143 12665 3230 12565 15065 15056 5090 16908 13677 12634 11435 1425 8647 3876 10694 12256 3853 19901 5723 11065 6147 13613 13768 15794 14993 5819 8117 13871 14708 15099 7152 9810 14438 10557 3209 1265 13915...

output:

157122482
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
826457499
...

result:

ok 200000 tokens

Test #3:

score: 0
Accepted
time: 156ms
memory: 47924kb

input:

200000
4065 9196 2588 18803 10818 17671 10483 13134 12147 19916 19382 19338 8864 7637 19542 14938 16362 7115 9159 9711 17907 17653 10175 3279 7471 3465 14016 13951 8676 2856 16709 5372 12237 18083 11052 16398 7140 9730 8800 18999 16808 8729 7608 6668 7049 6024 7892 18039 7278 12417 2440 13112 4039 5...

output:

47583147
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
345009231
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
370164779
3...

result:

ok 200000 tokens

Test #4:

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

input:

200000
1 1 1 1 4547 1 1 1 1 1 1 1 6329 1 1 19778 1 1 12258 1 1 1 1 1 18104 1 8123 1 329 1 1 1 1 1 1 1 1 4438 1 1 1 1 1 208 1 1 1 1 1 1 1 1 1 15603 1 1 1 1 1 1 1 1 1 1 5513 1 1 15427 1 1 1 1 1 1 1 18309 1 1 6333 1 1 1 1 1 1 1 1 1 13938 1 1 1 1 1 1 9229 1 1 1 1 1 1 1 1 1791 1 1 1 11747 1 1 1 1 8992 1 ...

output:

225508548
225508548
225508548
225508548
748768610
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
225508548
...

result:

ok 200000 tokens

Test #5:

score: 0
Accepted
time: 184ms
memory: 49524kb

input:

200000
1 1 1 1 1 1 1 10166 1 1 9410 1 1 1 1 1 1 1 1 1 296 1 1 1 1 1 1 1 1 1 1 7392 4057 17616 1 1 1 1 3084 14799 1 1 13598 1 1 9848 1 1 1 1 1 8084 1 1 1 1 1 1 1 1 10519 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 14981 1 1 1 1 1 1 1 1 1 5144 7784 1 1 1 1 1 1 1 19661 1 14894 1 1 1 1 1 1 1 1 10449 1 1 1 16473 1 ...

output:

735167914
735167914
735167914
735167914
735167914
735167914
735167914
211149010
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
735167914
...

result:

ok 200000 tokens

Test #6:

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

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 6 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 6 1 1 1 2397 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
415221870
450552969
425969980
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
450552969
...

result:

ok 200000 tokens

Test #7:

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

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9861 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1739 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11012 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1...

output:

723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
723674232
76256586
723674232
723674232
723674232
723674232
723674232
723674232
7...

result:

ok 200000 tokens

Test #8:

score: 0
Accepted
time: 184ms
memory: 59180kb

input:

200000
1 1 1 1 1 1 1 1 1 1 29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1...

output:

529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
773664190
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
529842888
...

result:

ok 200000 tokens

Test #9:

score: 0
Accepted
time: 182ms
memory: 59264kb

input:

200000
1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

806160702
806160702
806160702
806160702
806160702
364515698
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
806160702
331355896
806160702
806160702
806160702
806160702
806160702
806160702
806160702
...

result:

ok 200000 tokens

Test #10:

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

input:

200000
1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 ...

output:

819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
640790101
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
819517227
94445283
819517227
819517227
819517227
8...

result:

ok 200000 tokens

Test #11:

score: 0
Accepted
time: 199ms
memory: 64136kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 ...

output:

224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
224346786
883675827
224346786
724940402
224346786
224346786
224346786
224346786
224346786
...

result:

ok 200000 tokens

Test #12:

score: 0
Accepted
time: 170ms
memory: 53316kb

input:

200000
380 1947 45 613 973 1687 176 1238 889 1168 1165 626 1832 727 27 1848 512 31 1243 94 427 1462 389 1824 1026 1103 1317 212 774 1115 1076 150 797 348 761 1763 418 1681 1795 1813 309 762 1880 1081 1375 1988 98 41 1800 171 1116 1633 71 1241 1358 1420 19 688 1318 787 1655 1377 32 947 1232 953 76 39...

output:

425384391
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
717656467
...

result:

ok 200000 tokens

Test #13:

score: 0
Accepted
time: 141ms
memory: 53304kb

input:

200000
255 1944 1577 1738 1298 700 988 1061 626 1361 769 1602 1611 1838 275 297 1330 1553 659 267 764 1775 657 342 153 1406 536 1475 1736 1701 1014 1391 1047 1147 1290 1280 1227 1570 1287 1822 1896 564 1016 325 155 830 121 33 1088 1784 1611 656 1566 1225 158 705 1729 1605 1313 875 102 333 1550 990 6...

output:

983788768
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
7611565
76...

result:

ok 200000 tokens

Test #14:

score: 0
Accepted
time: 186ms
memory: 54572kb

input:

200000
1 1 894 1 1 1 1 1 1 1 1 1 1 1666 1 1 1648 1 1 1 1 822 1 1 1 1 1 1 1 218 1 1 132 1 1 1 1 1 1 1 1067 1 1 1 1 1 1 1 1 1 1 1178 1 1 1 1 70 1 1 1 1 1 1 1 1 1665 243 1 1 1 1 1 1925 1 1 1 1 1 1 1 975 1 1 1 1 1 1 1 1 1 1469 1 1 1 1 1 1 1 1 1 839 1 359 1 1 1 1 1 1 1 1 1790 1 1 1 1388 1 1 1 1 1 1 1 1 1...

output:

718644419
718644419
103241866
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
718644419
...

result:

ok 200000 tokens

Test #15:

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

input:

200000
1 1 1 1 1 1 1 1 1 714 1 1 1 1 1 661 1 1 1 1 1 1 1 1724 1 1 1 1 1 1 1 1 1 1 924 911 1 1 1 1 1 1 1192 1 1 1 1 1 1907 1 1 1 388 1 1 1 1 1 1 1 1 1 1 1910 1 1 1 1 1304 1 1 1 1 1 1 1 1 1168 1 1 1 1 1 1 1 1 1872 1 194 1 1 1 33 1 1 1602 1 1 1 1 1 1 324 1 1 1 1 1 1 1 1 1 1 28 1 1 1 1 1 1 701 1 1 1 1 1...

output:

422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
767529344
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
422022560
...

result:

ok 200000 tokens

Test #16:

score: 0
Accepted
time: 194ms
memory: 59452kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1451 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
353202539
...

result:

ok 200000 tokens

Test #17:

score: 0
Accepted
time: 173ms
memory: 59360kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 812 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
858605372
...

result:

ok 200000 tokens

Test #18:

score: 0
Accepted
time: 166ms
memory: 63972kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
761164523
...

result:

ok 200000 tokens

Test #19:

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

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
90869376
908...

result:

ok 200000 tokens

Test #20:

score: 0
Accepted
time: 157ms
memory: 64972kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
526920358
...

result:

ok 200000 tokens

Test #21:

score: 0
Accepted
time: 179ms
memory: 65040kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
24467815
244...

result:

ok 200000 tokens

Test #22:

score: 0
Accepted
time: 185ms
memory: 58284kb

input:

200000
53 129 38 148 167 107 148 99 161 198 71 149 103 49 36 144 57 11 107 15 72 75 91 154 191 190 177 122 197 36 196 126 150 108 6 117 81 58 51 55 181 135 106 181 149 165 150 38 5 63 194 84 89 4 135 175 63 78 74 32 47 106 10 16 161 88 50 95 4 82 58 181 156 197 194 21 138 91 105 106 109 159 51 76 86...

output:

300601705
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
18494655
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
553401883
5...

result:

ok 200000 tokens

Test #23:

score: 0
Accepted
time: 181ms
memory: 58256kb

input:

200000
52 30 8 75 150 80 87 129 133 108 88 182 41 198 109 56 92 42 42 125 198 86 140 131 17 184 31 81 195 150 39 66 12 95 168 49 55 142 5 72 43 191 179 152 65 77 175 168 126 77 193 58 124 43 154 38 2 52 22 153 190 143 109 19 92 116 27 59 174 24 184 24 142 80 130 151 61 34 101 71 54 50 125 40 54 101 ...

output:

576237374
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
566996520
...

result:

ok 200000 tokens

Test #24:

score: 0
Accepted
time: 210ms
memory: 60124kb

input:

200000
1 1 1 113 1 1 1 1 1 1 1 1 1 24 1 109 1 1 1 1 1 160 1 1 1 1 1 1 1 1 133 1 1 89 1 1 1 1 33 1 1 1 1 164 1 1 1 1 1 186 1 1 1 1 1 1 115 1 1 1 1 1 1 1 1 30 1 1 1 1 170 55 1 1 1 76 1 1 1 1 1 1 1 190 1 1 1 1 1 1 1 162 1 1 1 1 6 1 1 1 1 1 1 1 1 182 186 1 1 50 1 1 1 1 67 1 1 1 1 1 1 165 1 1 1 1 1 1 1 1...

output:

725226252
725226252
725226252
750600882
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
725226252
...

result:

ok 200000 tokens

Test #25:

score: 0
Accepted
time: 209ms
memory: 60124kb

input:

200000
1 1 1 1 1 1 1 1 1 17 1 1 1 1 126 1 1 1 1 1 1 1 1 95 1 1 169 1 1 1 1 1 1 1 197 1 1 1 1 143 1 1 1 1 1 1 117 1 1 1 1 1 117 1 73 1 1 183 1 153 1 1 1 1 1 1 1 130 1 1 1 1 1 94 1 1 1 1 1 75 1 1 1 1 88 62 1 1 1 1 1 1 1 70 1 1 1 1 1 1 1 1 13 1 1 1 39 1 1 1 1 1 1 1 45 191 1 1 157 1 1 1 1 1 1 1 1 1 152 ...

output:

183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
262661924
183224204
183224204
183224204
183224204
592152678
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
183224204
...

result:

ok 200000 tokens

Test #26:

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

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 73 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 156 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
827635970
...

result:

ok 200000 tokens

Test #27:

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

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 73 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 173 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
582217512
478963203
...

result:

ok 200000 tokens

Test #28:

score: 0
Accepted
time: 172ms
memory: 64988kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
700746312
...

result:

ok 200000 tokens

Test #29:

score: 0
Accepted
time: 168ms
memory: 64988kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
433215183
...

result:

ok 200000 tokens

Test #30:

score: 0
Accepted
time: 169ms
memory: 65068kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
961570465
...

result:

ok 200000 tokens

Test #31:

score: 0
Accepted
time: 168ms
memory: 65136kb

input:

200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
92548611
925...

result:

ok 200000 tokens

Test #32:

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

input:

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

output:

80012380
42591007
69231102
42591007
42591007
42591007
42591007
42591007
42591007
57677538
42591007
52642780
54058087
42591007
46599929
59143905
44398018
43705698
44704063
45528542
45084289
48840558
45527037
48481629
50222919
49038124
44681995
44595932
45406740
47724058
42591007
46944631
45429315
459...

result:

ok 100 tokens

Test #33:

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

input:

100
12 1 2 11 1 4 6 15 2 9 12 8 11 2 16 8 10 7 17 10 5 17 4 5 6 16 7 7 17 14 15 7 5 10 10 3 15 1 17 7 10 20 11 12 13 16 5 6 12 13 8 2 8 12 18 12 6 13 13 7 12 17 18 4 20 13 3 11 10 2 6 14 3 15 8 12 13 10 6 19 12 19 8 17 7 14 17 15 20 17 12 10 8 13 2 13 16 20 10 14

output:

24171
5221
5221
5221
5221
5221
5221
7856
5221
5221
5221
5221
5221
5221
5911
5221
5771
5715
5667
5626
5561
5531
5482
5438
5397
5378
5361
5346
5362
5319
5307
5296
5286
5333
5365
5385
5816
5221
5715
5405
5410
6750
5389
5401
5411
5408
5401
5403
5403
5401
5557
5391
5536
5381
5660
5383
5381
5373
5374
5339...

result:

ok 100 tokens

Test #34:

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

input:

300
3 11 20 7 16 12 9 18 7 19 10 18 12 14 20 18 7 10 4 5 3 5 2 19 19 13 11 16 3 18 4 15 9 7 5 1 9 14 11 8 15 3 14 12 13 2 20 5 11 2 20 15 5 14 12 13 5 3 15 11 10 8 20 8 10 1 17 4 5 5 20 14 7 5 14 7 10 2 7 14 17 14 7 15 7 12 9 20 2 3 14 14 12 11 2 9 14 9 16 16 16 10 1 18 18 7 1 12 6 12 13 16 11 16 10...

output:

697699638
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
421636433
54311805
74687058
666711641
398242955
666711641
448424433
898399680
994443712
466058054
743345614
30...

result:

ok 300 tokens

Test #35:

score: 0
Accepted
time: 199ms
memory: 63728kb

input:

200000
2 2 2 1 1 3 2 1 2 3 3 2 2 3 3 1 1 2 1 1 1 1 2 3 3 1 3 1 3 2 1 2 3 3 2 2 3 1 3 1 2 3 3 1 3 1 2 3 3 2 2 3 3 2 1 1 1 2 1 3 1 1 1 2 3 3 1 3 1 2 3 3 1 2 3 2 2 3 2 2 1 1 3 2 3 3 3 3 2 3 2 1 2 2 1 2 3 1 2 3 2 3 1 3 3 2 1 1 2 2 2 1 2 2 2 3 3 3 3 3 1 1 1 1 2 3 2 2 2 1 3 1 3 3 3 2 1 3 1 1 1 1 3 3 1 3 2...

output:

444398413
665936789
555167601
665936789
665936789
143361571
761070616
665936789
376412429
25202780
376412429
727622078
961761844
610552195
555167601
665936789
665936789
555167601
665936789
665936789
665936789
665936789
483337931
809596129
483337931
665936789
790126370
665936789
626997271
65780304
66...

result:

ok 200000 tokens

Test #36:

score: 0
Accepted
time: 249ms
memory: 61600kb

input:

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

output:

317998635
375262180
375262180
375262180
375262180
375262180
375262180
375262180
375262180
404121322
707747700
615811947
527917555
768028500
708601872
613829643
842252844
993668088
340214511
766253777
651069439
435190184
375262180
729610616
394965425
808180413
235927248
308475028
44493600
983865994
1...

result:

ok 200000 tokens

Test #37:

score: 0
Accepted
time: 200ms
memory: 59384kb

input:

200000
16 29 19 26 5 10 8 12 9 21 28 20 15 15 16 14 1 5 5 16 28 3 13 23 22 15 22 12 1 14 19 24 25 15 8 8 13 3 1 27 28 18 8 7 27 2 18 9 2 13 13 15 18 23 21 23 27 7 7 10 16 5 19 29 20 17 28 20 22 26 9 6 5 13 19 23 2 16 21 9 17 12 21 22 23 15 5 9 30 3 24 11 4 22 22 17 6 22 22 24 21 29 25 17 15 30 16 4 ...

output:

293045010
627024432
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
402867102
793281169
...

result:

ok 200000 tokens

Test #38:

score: 0
Accepted
time: 167ms
memory: 56728kb

input:

200000
50 59 99 95 33 98 12 85 55 40 37 89 51 7 71 52 85 91 76 34 29 60 95 2 41 36 4 42 91 6 85 4 53 48 15 51 46 10 13 71 68 8 16 84 33 24 98 91 56 58 63 78 7 26 51 55 75 5 6 13 5 37 14 27 36 12 65 63 81 61 52 67 14 60 89 28 43 88 42 22 29 80 36 81 42 15 24 95 78 74 49 80 56 11 93 69 25 64 84 21 77 ...

output:

936814648
597799851
516815561
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
597799851
...

result:

ok 200000 tokens

Test #39:

score: 0
Accepted
time: 164ms
memory: 54032kb

input:

200000
379 16 236 260 348 139 380 67 302 67 72 159 151 256 214 211 160 257 211 80 166 392 141 169 282 395 279 295 98 181 312 181 54 274 124 244 371 22 241 57 11 263 76 59 291 255 322 149 36 107 15 346 380 110 258 123 138 63 31 243 340 246 155 316 20 163 132 151 279 8 311 121 253 90 184 104 300 243 7...

output:

470409828
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31086466
31...

result:

ok 200000 tokens

Test #40:

score: 0
Accepted
time: 161ms
memory: 50924kb

input:

200000
1430 963 1357 314 1109 864 1348 496 1183 220 719 1261 703 333 1365 198 721 685 1143 1447 1351 367 891 20 768 1169 754 319 1113 1191 974 532 1466 455 241 1176 1019 563 344 655 868 1446 989 1318 624 679 682 802 575 368 1475 127 128 565 828 1077 1236 519 676 1190 1029 457 1479 1498 752 598 445 1...

output:

380199761
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69057399
69...

result:

ok 200000 tokens

Test #41:

score: 0
Accepted
time: 146ms
memory: 49160kb

input:

200000
3162 3453 3258 3108 3715 3752 230 2743 307 1739 2982 2307 3232 2031 217 3242 2581 3886 3381 1091 1744 2648 2274 2006 516 3889 3101 1889 632 3953 2263 2486 2503 1699 468 3226 254 2310 2285 808 1570 2895 302 1324 231 3685 1944 2889 3577 1060 3648 788 2647 2363 398 918 3603 750 1728 2317 3507 13...

output:

321639721
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19554262
19...

result:

ok 200000 tokens

Test #42:

score: 0
Accepted
time: 157ms
memory: 46988kb

input:

200000
3522 6233 4157 6952 6534 9727 5324 7793 4986 8897 7296 5464 4821 2088 5419 6193 6004 5666 9477 770 2985 6416 6695 5064 5175 7272 3762 9586 5432 7299 6758 7413 6951 736 7851 534 198 6592 9611 3283 2970 5416 4885 3691 2538 4370 9660 8785 6899 9004 3414 3821 2679 8471 8686 3994 809 7369 5555 543...

output:

855664730
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
319694377
...

result:

ok 200000 tokens

Test #43:

score: 0
Accepted
time: 139ms
memory: 44556kb

input:

200000
13151 13043 15939 4003 3799 6745 14758 17658 1854 19751 1506 3696 12946 19913 3753 13151 17222 1709 6493 9035 18831 17719 10008 535 2408 8478 4213 21854 9407 15853 11588 555 16502 8019 15482 1472 15202 7603 3534 21219 6640 19349 4766 16653 18795 5827 14424 2265 17783 14797 18593 14379 570 219...

output:

949527696
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
234505604
...

result:

ok 200000 tokens

Test #44:

score: 0
Accepted
time: 141ms
memory: 41584kb

input:

200000
2608 38741 4247 518 21640 5817 16595 36443 19472 32863 36988 2971 35495 3240 33019 1625 33801 38902 33556 7681 28451 713 15817 28438 5368 43525 22990 35934 40926 8274 36531 18945 42825 14619 36390 20013 29776 10864 26118 28797 19899 37340 28137 40485 10635 30471 17623 44560 19922 44365 34196 ...

output:

945517856
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
572879218
...

result:

ok 200000 tokens

Test #45:

score: 0
Accepted
time: 130ms
memory: 38064kb

input:

200000
58086 6368 7844 5558 62993 60348 48332 44365 69279 77503 79143 59809 9658 31300 11652 57084 9843 55079 46805 39534 54462 7370 38702 66250 12019 66578 78668 46374 8399 16616 69004 12255 68209 64953 47855 29843 49373 18166 21789 23589 23164 66197 49630 75068 47514 77454 11682 57924 47207 56158 ...

output:

80009
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
40005
...

result:

ok 200000 tokens

Test #46:

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

input:

200000
88473 4347 58303 84402 86559 8600 73964 26571 86439 76241 56293 13504 92885 49248 1793 36750 67732 113186 43932 4052 63055 92059 30739 6550 5049 96943 98890 3197 53446 110762 26217 83925 82032 42745 93787 111182 17843 39791 85198 74236 86352 49025 64245 32727 87758 34826 27017 19324 36853 658...

output:

2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 200000 tokens

Extra Test:

score: 0
Extra Test Passed