QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#843182#9963. Express Rotationsucup-team112#AC ✓693ms97960kbC++2316.8kb2025-01-04 17:11:002025-01-04 17:11:00

Judging History

This is the latest submission verdict.

  • [2025-01-04 17:11:00]
  • Judged
  • Verdict: AC
  • Time: 693ms
  • Memory: 97960kb
  • [2025-01-04 17:11:00]
  • Submitted

answer


//#define _GLIBCXX_DEBUG

//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
using namespace std;


#ifdef LOCAL
#include <debug_print.hpp>
#define OUT(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define OUT(...) (static_cast<void>(0))
#endif

#define endl '\n'
#define lfs cout<<fixed<<setprecision(15)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)

namespace template_tute{
  using ll = long long;
  using ld = long double;
  const ll MOD1 = 1e9+7;
  const ll MOD9 = 998244353;
  const ll INF = 4.1e18;
  using P = pair<ll, ll>;
  template<typename T> using PQ = priority_queue<T>;
  template<typename T> using QP = priority_queue<T,vector<T>,greater<T>>;
  template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
  template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
  ll median(ll a,ll b, ll c){return a+b+c-max<ll>({a,b,c})-min<ll>({a,b,c});}
  void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
  void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
  void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
  template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
  template<typename T1,typename T2,typename T3>void anss(T1 x,T2 y,T3 z){ans(x!=y,x,z);};  
  template<typename T>void debug(const T &v,ll h,ll w,string sv=" "){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout<<sv<<v[i][j];cout<<endl;}};
  template<typename T>void debug(const T &v,ll n,string sv=" "){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout<<sv<<v[i];cout<<endl;};
  template<typename T>void debug(const vector<T>&v){debug(v,v.size());}
  template<typename T>void debug(const vector<vector<T>>&v){for(auto &vv:v)debug(vv,vv.size());}
  template<typename T>void debug(stack<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
  template<typename T>void debug(queue<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop();}cout<<endl;}
  template<typename T>void debug(deque<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop_front();}cout<<endl;}
  template<typename T>void debug(PQ<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
  template<typename T>void debug(QP<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
  template<typename T>void debug(const set<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
  template<typename T>void debug(const multiset<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
  template<typename T,size_t size>void debug(const array<T, size> &a){for(auto z:a)cout<<z<<" ";cout<<endl;}
  template<typename T,typename V>void debug(const map<T,V>&v){for(auto z:v)cout<<"["<<z.first<<"]="<<z.second<<",";cout<<endl;}
  template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
  vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
  template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
  template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
  template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << "(" << p.first << "," << p.second << ")";}
  template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){os<<"[";for(auto &z:v)os << z << ",";os<<"]"; return os;}
  template<typename T>void rearrange(vector<int>&ord, vector<T>&v){
    auto tmp = v;
    for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
  }
  template<typename Head, typename... Tail>void rearrange(vector<int>&ord,Head&& head, Tail&&... tail){
    rearrange(ord, head);
    rearrange(ord, tail...);
  }
  template<typename T> vector<int> ascend(const vector<T>&v){
    vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],i)<make_pair(v[j],j);});
    return ord;
  }
  template<typename T> vector<int> descend(const vector<T>&v){
    vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],-i)>make_pair(v[j],-j);});
    return ord;
  }
  template<typename T> vector<T> inv_perm(const vector<T>&ord){
    vector<T>inv(ord.size());
    for(int i=0;i<ord.size();i++)inv[ord[i]] = i;
    return inv;
  }
  ll FLOOR(ll n,ll div){assert(div>0);return n>=0?n/div:(n-div+1)/div;}
  ll CEIL(ll n,ll div){assert(div>0);return n>=0?(n+div-1)/div:n/div;}
  ll digitsum(ll n){ll ret=0;while(n){ret+=n%10;n/=10;}return ret;}
  ll modulo(ll n,ll d){return (n%d+d)%d;};
  template<typename T>T min(const vector<T>&v){return *min_element(v.begin(),v.end());}
  template<typename T>T max(const vector<T>&v){return *max_element(v.begin(),v.end());}
  template<typename T>T acc(const vector<T>&v){return accumulate(v.begin(),v.end(),T(0));};
  template<typename T>T reverse(const T &v){return T(v.rbegin(),v.rend());};
  //mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
  int popcount(ll x){return __builtin_popcountll(x);};
  int poplow(ll x){return __builtin_ctzll(x);};
  int pophigh(ll x){return 63 - __builtin_clzll(x);};
  template<typename T>T poll(queue<T> &q){auto ret=q.front();q.pop();return ret;};
  template<typename T>T poll(priority_queue<T> &q){auto ret=q.top();q.pop();return ret;};
  template<typename T>T poll(QP<T> &q){auto ret=q.top();q.pop();return ret;};
  template<typename T>T poll(stack<T> &s){auto ret=s.top();s.pop();return ret;};
  ll MULT(ll x,ll y){if(LLONG_MAX/x<=y)return LLONG_MAX;return x*y;}
  ll POW2(ll x, ll k){ll ret=1,mul=x;while(k){if(mul==LLONG_MAX)return LLONG_MAX;if(k&1)ret=MULT(ret,mul);mul=MULT(mul,mul);k>>=1;}return ret;}
  ll POW(ll x, ll k){ll ret=1;for(int i=0;i<k;i++){if(LLONG_MAX/x<=ret)return LLONG_MAX;ret*=x;}return ret;}
  std::ostream &operator<<(std::ostream &dest, __int128_t value) {
    std::ostream::sentry s(dest);
    if (s) {
      __uint128_t tmp = value < 0 ? -value : value;
      char buffer[128];
      char *d = std::end(buffer);
      do {
        --d;
        *d = "0123456789"[tmp % 10];
        tmp /= 10;
      } while (tmp != 0);
      if (value < 0) {
        --d;
        *d = '-';
      }
      int len = std::end(buffer) - d;
      if (dest.rdbuf()->sputn(d, len) != len) {
        dest.setstate(std::ios_base::badbit);
      }
    }
    return dest;
  }
  namespace converter{
    int dict[500];
    const string lower="abcdefghijklmnopqrstuvwxyz";
    const string upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    const string digit="0123456789";
    const string digit1="123456789";
    void regi_str(const string &t){
      for(int i=0;i<t.size();i++){
        dict[t[i]]=i;
      }
    }
    void regi_int(const string &t){
      for(int i=0;i<t.size();i++){
        dict[i]=t[i];
      }
    }
    vector<int>to_int(const string &s,const string &t){
      regi_str(t);
      vector<int>ret(s.size());
      for(int i=0;i<s.size();i++){
        ret[i]=dict[s[i]];
      }
      return ret;
    }
    vector<int>to_int(const string &s){
      auto t=s;
      sort(t.begin(),t.end());
      t.erase(unique(t.begin(),t.end()),t.end());
      return to_int(s,t);
    }
    
    vector<vector<int>>to_int(const vector<string>&s,const string &t){
      regi_str(t);
      vector<vector<int>>ret(s.size(),vector<int>(s[0].size()));
      for(int i=0;i<s.size();i++){
        for(int j=0;j<s[0].size();j++){
          ret[i][j]=dict[s[i][j]];
        }
      }
      return ret;
    }
    vector<vector<int>>to_int(const vector<string>&s){
      string t;
      for(int i=0;i<s.size();i++){
        t+=s[i];
      }
      sort(t.begin(),t.end());t.erase(unique(t.begin(),t.end()),t.end());
      return to_int(s,t);
    }
    string to_str(const vector<int>&s,const string &t){
      regi_int(t);
      string ret;
      for(auto z:s)ret+=dict[z];
      return ret;
    }
    vector<string> to_str(const vector<vector<int>>&s,const string &t){
      regi_int(t);
      vector<string>ret(s.size());
      for(int i=0;i<s.size();i++){
        for(auto z:s[i])ret[i]+=dict[z];
      }
      return ret;
    }
  }
  template< typename T = int >
  struct edge {
    int to;
    T cost;
    int id;
    edge():to(-1),id(-1){};
    edge(int to, T cost = 1, int id = -1):to(to), cost(cost), id(id){}
    operator int() const { return to; }
  };

  template<typename T>
  using Graph = vector<vector<edge<T>>>;
  template<typename T>
  Graph<T>revgraph(const Graph<T> &g){
    Graph<T>ret(g.size());
    for(int i=0;i<g.size();i++){
      for(auto e:g[i]){
        int to = e.to;
        e.to = i;
        ret[to].push_back(e);
      }
    }
    return ret;
  }
  template<typename T>
  Graph<T> readGraph(int n,int m,int indexed=1,bool directed=false,bool weighted=false){
    Graph<T> ret(n);
    for(int es = 0; es < m; es++){
      int u,v;
      T w=1;
      cin>>u>>v;u-=indexed,v-=indexed;
      if(weighted)cin>>w;
      ret[u].emplace_back(v,w,es);
      if(!directed)ret[v].emplace_back(u,w,es);
    }
    return ret;
  }
  template<typename T>
  Graph<T> readParent(int n,int indexed=1,bool directed=true){
    Graph<T>ret(n);
    for(int i=1;i<n;i++){
      int p;cin>>p;
      p-=indexed;
      ret[p].emplace_back(i);
      if(!directed)ret[i].emplace_back(p);
    }
    return ret;
  }
}
using namespace template_tute;
template<typename T>
struct BIT{
  ll n;
  ll k=1;
  vector<T>data;
  BIT() = default;
  BIT(ll size):n(size){
    data.assign(n,0);
    while(k*2<=n)k*=2;
  }
  void add(ll a,T w){
    assert(0<=a);
    for(ll i=a+1;i<=n;i+=i&-i)data[i-1]+=w;
  }
  T sum(ll a){//[0,a)
    if(a<=0)return 0;
    T ret = 0;
    for(ll i=a;i>0;i-=i&-i)ret+=data[i-1];
    return ret;
  }
  //[a,b)
  T sum(ll a,ll b){return a>=b?0:sum(b)-sum(a);}
  T operator[](ll pos){
    return sum(pos,pos+1);
  }
  ll lower_bound(ll x){
    ll ret=0;
    for(ll i=k;i>0;i/=2){
      if(ret+i<=n&&data[ret+i-1]<x){
        x-=data[ret+i-1];
        ret+=i;
      }
    }
    return ret;
  }
  ll lower_first(ll x){
    return lower_bound(sum(n)-x+1);
  }
  void print(){
    for(ll i=0;i<n;i++){
      if(i!=0)cout<<" ";
      cout<<(*this)[i];
    }
    cout<<endl;
  }
};
template< typename Monoid, typename OperatorMonoid,typename F, typename G, typename H>
struct LazySegmentTree {
  ll sz, height, n;
  vector< Monoid > data;
  vector< OperatorMonoid > lazy;
  const F f;
  const G g;
  const H h;
  Monoid M1;
  OperatorMonoid OM0;
  LazySegmentTree(int n, const F &f,const G &g, const H &h, Monoid M1, OperatorMonoid OM0):n(n),f(f),g(g),h(h),M1(M1),OM0(OM0){
    sz = 1;
    height = 0;
    while(sz < n) sz <<= 1, height++;
    data.assign(2 * sz, M1);
    lazy.assign(2 * sz, OM0);
  }

  void set(ll k, const Monoid &x) {
    data[k + sz] = x;
  }

  void build() {
    for(ll k = sz - 1; k > 0; k--) {
      data[k] = f(data[2 * k + 0], data[2 * k + 1]);
    }
  }

  inline void propagate(int k) {
    if(lazy[k] != OM0) {
      lazy[2 * k + 0] = h(lazy[2 * k + 0], lazy[k]);
      lazy[2 * k + 1] = h(lazy[2 * k + 1], lazy[k]);
      data[k] = reflect(k);
      lazy[k] = OM0;
    }
  }

  inline Monoid reflect(int k) {
    return lazy[k] == OM0 ? data[k] : g(data[k], lazy[k]);
  }

  inline void recalc(int k) {
    while(k >>= 1) data[k] = f(reflect(2 * k + 0), reflect(2 * k + 1));
  }

  inline void thrust(int k) {
    for(ll i = height; i > 0; i--) propagate(k >> i);
  }

  void update(int a, int b, const OperatorMonoid &x) {
  if(a>=b)return;
    thrust(a += sz);
    thrust(b += sz - 1);
    for(ll l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) lazy[l] = h(lazy[l], x), ++l;
      if(r & 1) --r, lazy[r] = h(lazy[r], x);
    }
    recalc(a);
    recalc(b);
  }

  void update(int a,const Monoid &x){
    thrust(a += sz);
    data[a] = x;
    lazy[a] = OM0;
    recalc(a);
  }

  Monoid query(int a, int b) {
  if(a>=b)return M1;
    thrust(a += sz);
    thrust(b += sz - 1);
    Monoid L = M1, R = M1;
    for(ll l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) L = f(L, reflect(l++));
      if(r & 1) R = f(reflect(--r), R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) {
    return query(k, k + 1);
  }
  Monoid all_prod(){
    return reflect(1);
  }

  template< typename C >
  ll find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      propagate(a);
      Monoid nxt = type ? f(reflect(2 * a + type), M) : f(M, reflect(2 * a + type));
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }

  template< typename C >
  ll find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, reflect(1)))) return find_subtree(1, check, L, false);
      return n;
    }
    thrust(a + sz);
    ll b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, reflect(a));
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return n;
  }


  template< typename C >
  ll find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(reflect(1), R))) return find_subtree(1, check, R, true);
      return -1;
    }
    thrust(b + sz - 1);
    ll a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(reflect(--b), R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
  void print(){
    for(ll i=0;i<n;i++)if((*this)[i]==M1)cout<<"x|";else cout<<(*this)[i]<<"|";
    cout<<endl;
  }
};
namespace add_min{
  using M=ll;
  auto f=[](M x,M y){
    return min(x,y);
  };
  auto g=[](M x,M y){
    return x + y;
  };
  auto h=[](M x,M y){
    return x + y;
  };
  LazySegmentTree<M,M,decltype(f),decltype(g),decltype(h)>make(int n){
    return {n,f,g,h,INF,0};
  }
}


void solve(){
	ll res=0,buf=0;
  bool judge = true;

  ll n;cin>>n;
  ll sz=1000005;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  a.insert(a.begin(),1000001);
  n++;
  vector<vector<int>>idx(sz);
  rep(i,0,n){
    idx[a[i]].push_back(i);
  }
  BIT<ll>bit(2*n);
  rep(i,0,2*n){
    bit.add(i,a[i%n]);
  }
  //bit.print();
  ll pre=a[0];
  vector<ll>dp(n,INF);
  dp[0]=0;
  rrep(i,0,pre){
    if(idx[i].size()==0)continue;
    vector<pair<int,int>>p;
    for(auto z:idx[pre]){
      bit.add(z,-a[z]);
      bit.add(z+n,-a[z]);
      p.EB(z,0);
    }
    for(auto z:idx[i]){
      p.EB(z,1);
    }
    sort(ALL(p));
    pre=i;
    ll m=p.size();
    vector<ll>d(m);
    rep(i,0,m-1){
      d[i]=bit.sum(p[i].fi,p[i+1].fi);
    }
    d[m-1]=bit.sum(p[m-1].fi,p[0].fi+n);
    vector<ll>ldp(m,INF);
    vector<ll>rdp(m,INF);
    rep(j,0,p.size()){
      if(p[j].se==0){
        ldp[j]=rdp[j]=dp[p[j].fi];
      }
    }
    rrep(j,0,2*m){
      chmin(ldp[j%m],ldp[(j+1)%m]+d[j%m]);
    }
    //OUT(ldp);
    rep(j,0,2*m){
      //OUT(d[j%m],p[j%m],i);
      chmin(ldp[(j+1)%m],ldp[j%m]+d[j%m]-(p[j%m].se==1?i:0));
    }
    //OUT(ldp);
    {
      auto seg=add_min::make(2*m);
      rep(i,0,2*m){
        seg.set(i,ldp[i%m]);
      }
      seg.build();
      rep(j,0,2*m){
        if(j>=m)rdp[j%m]=seg.query(j-m+1,j+1);
        seg.update(0,j+1,d[j%m]-(p[j%m].se==1?2*i:0));
        //OUT(i,j);seg.print();
      }
    }
    //OUT(p);
    {
      ll rti=-1;
      rep(j,0,2*m){
        if(p[j%m].se==1){
          if(rti!=-1){
            ll rt=p[rti].fi;
            ll lt=p[j%m].fi;
            if(j>=m)lt+=n;
            ll cost=bit.sum(lt,rt+n);
            if(p[j%m].fi==rt)cost=0;
            //OUT(rt,p[j%m].fi,j,rti,cost);
            chmin(dp[rt],
              cost+ldp[j%m]-i*(idx[i].size()-1));
            chmin(dp[p[j%m].fi],
              cost+rdp[rti]);
          }
          rti=j;
          if(j>=m)break;
        }
      }
    }
    //OUT(i,dp,p,ldp,rdp,d);
    //bit.print();
  }
  ll ret=INF;
  for(auto z:idx[pre]){
    chmin(ret,dp[z]);
  }
  cout<<ret<<endl;
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  int T = 1;
  //cin>>T;
  while(T--){
    solve();
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 8ms
memory: 26736kb

input:

6
6 10 6 5 4 5

output:

16

result:

ok 1 number(s): "16"

Test #2:

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

input:

1
525434

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

20
724315 660084 703741 660084 33388 703741 724315 608476 703741 33388 660084 33388 703741 703741 724315 33388 660084 703741 703741 33388

output:

10450373

result:

ok 1 number(s): "10450373"

Test #4:

score: 0
Accepted
time: 7ms
memory: 26672kb

input:

1000
205212 781871 811133 847754 365647 686203 781871 811133 205212 811133 365647 553550 205212 365647 811133 205212 205212 781871 875225 781871 365647 344701 205212 875225 365647 365647 811133 781871 875225 811133 781871 365647 553550 686203 365647 79214 553550 686203 781871 781871 875225 811133 20...

output:

1703022119

result:

ok 1 number(s): "1703022119"

Test #5:

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

input:

1000
301641 35540 535041 598876 422289 932926 891853 928749 403425 515013 323155 468767 875308 397761 252409 674812 40987 889920 172600 98116 799381 718712 739731 228116 729441 314232 916892 391198 205018 977734 406583 970126 527675 752117 616274 614112 241590 226939 726732 976461 657267 705600 9482...

output:

40529669812

result:

ok 1 number(s): "40529669812"

Test #6:

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

input:

100000
94951 895049 212507 728671 498212 74168 617364 727973 327553 437083 222970 617364 575451 478998 352348 386134 274500 366753 57576 139115 368828 29040 930954 301558 521133 343205 520174 291315 53520 354416 89181 852743 480847 499918 602700 770649 61483 524841 957354 355385 376270 327553 402615...

output:

8404763653182

result:

ok 1 number(s): "8404763653182"

Test #7:

score: 0
Accepted
time: 350ms
memory: 95104kb

input:

500000
96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770 96770...

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 528ms
memory: 97384kb

input:

500000
129816 510350 129816 510350 510350 129816 510350 129816 510350 510350 510350 129816 129816 510350 510350 510350 510350 510350 129816 129816 510350 129816 129816 129816 129816 510350 129816 510350 129816 129816 510350 129816 510350 510350 129816 129816 129816 510350 129816 129816 510350 510350...

output:

32428426248

result:

ok 1 number(s): "32428426248"

Test #9:

score: 0
Accepted
time: 603ms
memory: 90616kb

input:

500000
294824 335847 938807 938807 938807 335847 294824 294824 335847 294824 335847 335847 938807 294824 294824 335847 335847 335847 294824 294824 335847 938807 294824 938807 335847 335847 335847 938807 938807 335847 938807 335847 938807 938807 294824 938807 294824 335847 938807 294824 335847 294824...

output:

154046626746

result:

ok 1 number(s): "154046626746"

Test #10:

score: 0
Accepted
time: 616ms
memory: 71692kb

input:

500000
382273 320210 382273 382273 843312 674692 674692 320210 320210 843312 382273 843312 674692 843312 674692 320210 674692 843312 320210 674692 843312 843312 843312 843312 674692 382273 320210 674692 843312 320210 674692 674692 674692 843312 320210 674692 382273 320210 843312 843312 674692 843312...

output:

299577484305

result:

ok 1 number(s): "299577484305"

Test #11:

score: 0
Accepted
time: 637ms
memory: 70980kb

input:

500000
249890 351331 351331 351331 351331 126347 351331 126347 351331 126347 616581 530898 530898 126347 249890 351331 530898 616581 249890 351331 616581 530898 530898 616581 351331 530898 126347 249890 351331 249890 530898 249890 351331 126347 616581 126347 616581 616581 530898 126347 249890 616581...

output:

248864555855

result:

ok 1 number(s): "248864555855"

Test #12:

score: 0
Accepted
time: 625ms
memory: 59224kb

input:

500000
94026 641203 702718 714723 525738 248544 748421 525738 94026 864039 748421 525738 94026 748421 748421 702718 580344 525738 819227 748421 748421 702718 702718 748421 525738 525738 714723 94026 94026 864039 94026 819227 819227 248544 248544 864039 94026 580344 248544 819227 641203 748421 525738...

output:

1023023617751

result:

ok 1 number(s): "1023023617751"

Test #13:

score: 0
Accepted
time: 598ms
memory: 48500kb

input:

500000
103295 870621 892810 331686 15987 647972 772524 994916 184758 517232 499499 605590 695105 459977 710069 702772 451750 400618 358392 470414 206695 500553 623696 874982 805356 103295 206695 19597 772524 267939 459977 73981 4791 18851 470414 795307 499499 470414 459977 459977 400618 994916 40017...

output:

8641129356811

result:

ok 1 number(s): "8641129356811"

Test #14:

score: 0
Accepted
time: 516ms
memory: 46084kb

input:

500000
37298 582477 97690 541999 281870 935680 512044 786878 904689 955151 976438 310602 946215 404416 512790 814945 660878 632854 116990 52377 774262 15509 506396 331821 16911 786613 422485 960070 504317 494521 188423 392620 816966 960273 7858 805633 273483 548662 80365 898508 527748 809716 492089 ...

output:

85730469360714

result:

ok 1 number(s): "85730469360714"

Test #15:

score: 0
Accepted
time: 440ms
memory: 45584kb

input:

500000
416655 331564 819260 103525 618092 216371 116303 233195 499263 905925 621087 673616 369303 459733 135999 563095 780651 326581 983477 958860 597022 245943 755943 338262 880430 938175 862558 924991 496206 240830 202625 81771 162937 913613 350167 384650 838540 121902 498371 797434 837565 724332 ...

output:

790834087104817

result:

ok 1 number(s): "790834087104817"

Test #16:

score: 0
Accepted
time: 358ms
memory: 48716kb

input:

500000
282408 89389 627523 155078 752756 180156 236392 956984 382806 973356 549457 960994 469753 431574 827385 141173 201865 898139 654346 467105 114464 415069 311863 691835 541824 440289 646884 688474 83022 973159 439189 917356 232536 947325 747466 378834 445970 589361 829312 65949 126195 939111 90...

output:

4995532417409133

result:

ok 1 number(s): "4995532417409133"

Test #17:

score: 0
Accepted
time: 357ms
memory: 55072kb

input:

500000
134805 200887 179916 246513 457185 276216 970795 860363 391508 14549 556006 514624 573841 703690 477057 981127 148195 864121 173567 333638 757769 152703 249733 979388 313661 484901 667946 283794 165181 295653 946007 82230 840919 162463 721229 774512 24925 791024 352493 455705 462540 21979 578...

output:

9313826433020205

result:

ok 1 number(s): "9313826433020205"

Test #18:

score: 0
Accepted
time: 433ms
memory: 47004kb

input:

500000
986386 983736 983077 991627 997951 980664 994136 984944 980003 995558 996024 983308 991807 985404 981124 980756 991778 995193 982141 996331 993355 985346 995303 981435 994795 985565 993768 992806 980238 996367 988601 985844 986426 990476 985716 999253 990505 980381 990013 990625 997901 992718...

output:

2334575675034431

result:

ok 1 number(s): "2334575675034431"

Test #19:

score: 0
Accepted
time: 641ms
memory: 97148kb

input:

500000
505173 505173 491662 491662 505173 491662 441035 397157 491662 800685 505173 505173 491662 505173 505173 505173 491662 505173 491662 505173 279787 892128 505173 491662 505173 537525 931899 646427 505173 505173 491662 491662 491662 505173 491662 491662 505173 505173 491662 707629 505173 692548...

output:

220133680303131

result:

ok 1 number(s): "220133680303131"

Test #20:

score: 0
Accepted
time: 683ms
memory: 97960kb

input:

500000
498868 498868 498868 498868 498868 498868 498868 498868 509125 498868 498868 498868 498868 498868 498868 509125 498868 509125 498868 509125 509125 498868 509125 498868 498868 498868 498868 509125 498868 498868 509125 509125 509125 509125 509125 498868 498868 498868 509125 498868 498868 498868...

output:

51180589680574

result:

ok 1 number(s): "51180589680574"

Test #21:

score: 0
Accepted
time: 611ms
memory: 97092kb

input:

500000
495000 505000 495000 524050 505000 495000 495000 505000 753444 505000 931302 495000 584194 868788 906436 347987 505000 495000 495000 495000 495000 505000 860236 495000 505000 505000 505000 847589 495000 495000 694665 415404 224090 945230 185952 525414 545225 284971 64148 505000 505000 897128 ...

output:

126456169901015

result:

ok 1 number(s): "126456169901015"

Test #22:

score: 0
Accepted
time: 605ms
memory: 94816kb

input:

481010
974736 974736 974736 974736 974736 960000 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 974736 960000 974736 974736 974736 974736 974736 974736 974736 974736...

output:

10369039522118

result:

ok 1 number(s): "10369039522118"

Test #23:

score: 0
Accepted
time: 621ms
memory: 94480kb

input:

481010
978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 960000 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050 978050...

output:

15129230589149

result:

ok 1 number(s): "15129230589149"

Test #24:

score: 0
Accepted
time: 581ms
memory: 94980kb

input:

481010
976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 960000 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543 976543...

output:

19223689969566

result:

ok 1 number(s): "19223689969566"

Test #25:

score: 0
Accepted
time: 584ms
memory: 96428kb

input:

481010
975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 960000 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252 975252...

output:

23600291276964

result:

ok 1 number(s): "23600291276964"

Test #26:

score: 0
Accepted
time: 601ms
memory: 94924kb

input:

481010
978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 960000 978904 978904 978904 995662 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904 978904...

output:

27892253460675

result:

ok 1 number(s): "27892253460675"

Test #27:

score: 0
Accepted
time: 578ms
memory: 95340kb

input:

481010
974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 960000 974004 974004 974004 974004 974004 974004 974004 960000 974004 974004 974004 960000 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004 974004...

output:

10515406734185

result:

ok 1 number(s): "10515406734185"

Test #28:

score: 0
Accepted
time: 580ms
memory: 95364kb

input:

481010
979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 960000 979466 979466 979466 979466 979466 979466 979466 960000 979466 979466 979466 979466 994958 960000 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466 979466...

output:

15191208121702

result:

ok 1 number(s): "15191208121702"

Test #29:

score: 0
Accepted
time: 584ms
memory: 95932kb

input:

481010
975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 975289 960000 975289 975289 975289 975289 975289 975289 975289 975289...

output:

19097049827371

result:

ok 1 number(s): "19097049827371"

Test #30:

score: 0
Accepted
time: 598ms
memory: 96108kb

input:

481010
970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 960000 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015 970015...

output:

23340773119713

result:

ok 1 number(s): "23340773119713"

Test #31:

score: 0
Accepted
time: 597ms
memory: 95284kb

input:

481010
978139 978139 978139 960000 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139 978139...

output:

27591165682459

result:

ok 1 number(s): "27591165682459"

Test #32:

score: 0
Accepted
time: 592ms
memory: 95844kb

input:

481010
972781 972781 972781 972781 960000 995166 972781 960000 972781 972781 972781 972781 972781 972781 972781 972781 972781 972781 960000 972781 972781 972781 972781 972781 972781 972781 972781 972781 960000 972781 972781 972781 972781 972781 972781 972781 960000 972781 972781 972781 972781 972781...

output:

10551133045606

result:

ok 1 number(s): "10551133045606"

Test #33:

score: 0
Accepted
time: 608ms
memory: 94112kb

input:

481010
973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 973172 960000 973172 973172 973172 973172...

output:

15114554898765

result:

ok 1 number(s): "15114554898765"

Test #34:

score: 0
Accepted
time: 609ms
memory: 95768kb

input:

481010
976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 997778 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 976677 960000 976677 976677 960000 976677 976677 976677 976677 976677 976677...

output:

19472181463610

result:

ok 1 number(s): "19472181463610"

Test #35:

score: 0
Accepted
time: 601ms
memory: 96028kb

input:

481010
975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 960000 975637 975637 975637 975637 975637 975637 975637 960000 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 975637 960000 975637...

output:

23137024772259

result:

ok 1 number(s): "23137024772259"

Test #36:

score: 0
Accepted
time: 590ms
memory: 94860kb

input:

481010
971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 960000 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 971616 960000 971616 971616 971616 971616 971616 971616 971616 971616...

output:

28021921191752

result:

ok 1 number(s): "28021921191752"

Test #37:

score: 0
Accepted
time: 598ms
memory: 94808kb

input:

481010
971386 971386 971386 971386 971386 971386 998051 960000 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 971386 960000 971386 971386 971386 971386 971386 971386 971386 971386 971386 960000 971386...

output:

10626793334587

result:

ok 1 number(s): "10626793334587"

Test #38:

score: 0
Accepted
time: 593ms
memory: 95336kb

input:

481010
978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 960000 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342 978342...

output:

15067715929711

result:

ok 1 number(s): "15067715929711"

Test #39:

score: 0
Accepted
time: 600ms
memory: 96048kb

input:

481010
977268 960000 960000 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 977268 960000 977268 977268 977268 977268 977268...

output:

19372872789178

result:

ok 1 number(s): "19372872789178"

Test #40:

score: 0
Accepted
time: 591ms
memory: 96072kb

input:

481010
978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658 978658...

output:

23718738219019

result:

ok 1 number(s): "23718738219019"

Test #41:

score: 0
Accepted
time: 597ms
memory: 96320kb

input:

481010
977390 960000 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390 977390...

output:

27811018246969

result:

ok 1 number(s): "27811018246969"

Test #42:

score: 0
Accepted
time: 415ms
memory: 95928kb

input:

500000
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998...

output:

499485001030

result:

ok 1 number(s): "499485001030"

Test #43:

score: 0
Accepted
time: 7ms
memory: 26656kb

input:

996
999999 999997 999995 999993 999991 999989 999987 999985 999983 999981 999979 999977 999975 999973 999971 999969 999967 999965 999963 999961 999959 999957 999955 999953 999951 999949 999947 999945 999943 999941 999939 999937 999935 999933 999931 999929 999927 999925 999923 999921 999919 999917 99...

output:

137417628557

result:

ok 1 number(s): "137417628557"

Test #44:

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

input:

7770
999999 998456 998452 998448 998458 998454 998464 998466 998462 998460 998470 998476 998474 998482 998468 998486 998472 998478 998484 998488 998480 998490 998496 998492 998494 998498 998502 998500 998506 998510 998508 998514 998504 998512 998518 998516 998522 998524 998520 998526 998532 998530 9...

output:

5422015217593

result:

ok 1 number(s): "5422015217593"

Test #45:

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

input:

500000
500002 500004 500006 500008 500010 500012 500014 500016 500018 500020 500022 500024 500026 500028 500030 500032 500034 500036 500038 500040 500042 500044 500046 500048 500050 500052 500054 500056 500058 500060 500062 500064 500066 500068 500070 500072 500074 500076 500078 500080 500082 500084...

output:

41666510416625000

result:

ok 1 number(s): "41666510416625000"

Test #46:

score: 0
Accepted
time: 195ms
memory: 59244kb

input:

500000
999997 500008 500012 500014 500004 500016 500006 500010 500024 500018 500020 500022 500028 500026 500030 500032 500036 500034 500042 500046 500040 500044 500038 500050 500048 500056 500052 500054 500064 500058 500060 500062 500068 500076 500066 500070 500072 500074 500078 500088 500080 500084...

output:

41666284416681547

result:

ok 1 number(s): "41666284416681547"

Test #47:

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

input:

500000
999997 999999 999995 999993 999991 999989 999987 999985 999981 999983 999977 999979 999975 999973 999969 999971 999967 999965 999963 999961 999957 999959 999953 999955 999949 999951 999947 999945 999941 999943 999937 999939 999933 999935 999931 999929 999925 999927 999921 999923 999917 999919...

output:

39062306832158133

result:

ok 1 number(s): "39062306832158133"

Test #48:

score: 0
Accepted
time: 235ms
memory: 47304kb

input:

499998
999995 833340 833336 833342 999987 999983 999975 999973 999993 999977 999985 999989 999963 999971 999979 999969 999965 999981 999959 999957 999953 999967 999961 999945 999955 999951 999947 999943 999941 999937 999949 999933 999927 999939 999921 999935 999917 999931 999925 999915 999909 999919...

output:

30863228314308669

result:

ok 1 number(s): "30863228314308669"

Test #49:

score: 0
Accepted
time: 211ms
memory: 46476kb

input:

500000
999999 999997 999995 999993 999991 999989 999987 999985 999983 999981 999979 999977 999975 999973 999971 999969 999967 999965 999963 999961 999959 999957 999955 999953 999951 999949 999947 999945 999943 999941 999939 999937 999935 999933 999931 999929 999927 999925 999923 999921 999919 999917...

output:

25064942057218750

result:

ok 1 number(s): "25064942057218750"

Test #50:

score: 0
Accepted
time: 265ms
memory: 46924kb

input:

499970
999997 970594 970596 970598 970600 970604 970602 970610 970608 970616 970612 970606 970618 970614 970620 970622 970624 970626 970632 970628 970630 970634 970638 970640 970646 970642 970654 970636 970644 970650 970656 970648 970652 970666 970658 970670 970662 970660 970664 970672 970668 970674...

output:

6995623188276727

result:

ok 1 number(s): "6995623188276727"

Test #51:

score: 0
Accepted
time: 256ms
memory: 46776kb

input:

500000
999999 999997 999993 999995 999991 999989 999985 999987 999983 999981 999979 999977 999975 999973 999971 999969 999967 999965 999963 999961 999959 999957 999955 999953 999949 999951 999945 999947 999941 999943 999939 999937 999933 999935 999929 999931 999927 999925 999921 999923 999917 999919...

output:

5991942346257990

result:

ok 1 number(s): "5991942346257990"

Test #52:

score: 0
Accepted
time: 492ms
memory: 48148kb

input:

498960
999981 999132 999138 999140 999997 999148 999126 999146 999134 999150 999136 999158 999128 999144 999160 999142 999168 999164 999152 999154 999170 999156 999130 999174 999176 999188 999180 999182 999166 999172 999186 999178 999194 999184 999196 999202 999162 999208 999204 999192 999198 999200...

output:

218966140893256

result:

ok 1 number(s): "218966140893256"

Test #53:

score: 0
Accepted
time: 609ms
memory: 47448kb

input:

480000
999999 999997 999995 999993 999989 999991 999985 999987 999983 999981 999977 999979 999973 999975 999969 999971 999998 1000000 999994 999996 999992 999990 999988 999986 999984 999982 999978 999980 999974 999976 999972 999970 999999 999997 999995 999993 999989 999991 999985 999987 999981 99998...

output:

7439588765369

result:

ok 1 number(s): "7439588765369"

Test #54:

score: 0
Accepted
time: 635ms
memory: 61296kb

input:

500000
999999 999997 999995 999993 999991 1000000 999998 999996 999994 999992 999999 999997 999995 999993 999991 1000000 999998 999996 999994 999992 999999 999997 999995 999993 999991 1000000 999998 999996 999994 999992 999999 999997 999995 999993 999991 1000000 999998 999996 999994 999992 999999 99...

output:

2249965750130

result:

ok 1 number(s): "2249965750130"

Test #55:

score: 0
Accepted
time: 335ms
memory: 54576kb

input:

500000
812861 511970 845879 720083 422831 925363 520962 861876 345474 481579 831175 938870 492121 673923 536361 631202 654132 960561 721778 714586 706201 680837 410250 872806 669424 456306 772443 656499 857175 507248 826901 781893 354339 669125 364780 866723 852331 943919 530164 932709 509744 643352...

output:

14994209523797208

result:

ok 1 number(s): "14994209523797208"

Test #56:

score: 0
Accepted
time: 355ms
memory: 50536kb

input:

500000
896971 695408 777585 802527 717660 828048 855239 857205 675532 741750 685618 945596 829744 748670 668804 912780 793985 934014 946647 963895 716229 971557 968350 699088 988135 970820 701487 927910 864648 887461 878506 962910 784807 994581 848684 847174 745869 683579 784008 893509 689092 924148...

output:

15175893468914505

result:

ok 1 number(s): "15175893468914505"

Test #57:

score: 0
Accepted
time: 439ms
memory: 47128kb

input:

500000
987954 987507 991095 996551 987213 989138 994005 990650 987046 995767 991526 992345 985453 989707 989038 999473 995404 991403 983176 984733 999236 995945 997585 982193 997208 989052 983074 987906 995081 983793 998924 993347 982542 994014 998749 985405 983584 983137 997435 987365 996419 994694...

output:

1535197698851341

result:

ok 1 number(s): "1535197698851341"

Test #58:

score: 0
Accepted
time: 464ms
memory: 45832kb

input:

500000
997140 993919 989459 994873 993251 996483 993153 989715 994433 993623 999830 992406 995313 997368 996100 994032 990301 996541 999468 992909 993184 998418 991169 998099 990437 991684 992296 996641 991013 992952 990713 999796 995748 990022 994221 996809 995852 991956 993900 992621 989853 997532...

output:

1297981422339047

result:

ok 1 number(s): "1297981422339047"

Test #59:

score: 0
Accepted
time: 515ms
memory: 45344kb

input:

499999
998654 998146 998162 999926 999730 998740 999109 998010 999540 999880 999959 998923 999736 999148 998120 998301 999428 999240 998583 998360 999736 999833 998046 999785 998251 998431 998065 998631 998474 999691 999412 998856 999998 999927 998738 998868 998574 999163 999216 999324 998624 999549...

output:

174680690347941

result:

ok 1 number(s): "174680690347941"

Test #60:

score: 0
Accepted
time: 573ms
memory: 47296kb

input:

500000
998785 999620 999093 997965 998972 998745 997980 997312 997895 997997 997941 998302 999073 998756 997273 997342 998302 997241 998349 996413 999527 997965 997788 998756 998972 999944 998302 998161 999527 996722 997941 998349 999381 998342 997997 998690 997154 999987 996402 998057 997760 996402...

output:

154972476263768

result:

ok 1 number(s): "154972476263768"

Test #61:

score: 0
Accepted
time: 644ms
memory: 69196kb

input:

500000
999991 999993 999985 999998 999991 999990 999985 1000000 999998 999990 999993 999998 999993 999991 999985 999990 1000000 999991 999985 999985 999990 999991 1000000 999998 999991 999993 999985 999993 999993 1000000 1000000 999991 999990 999991 999993 1000000 999990 999991 999990 1000000 999998...

output:

1293055072227

result:

ok 1 number(s): "1293055072227"

Test #62:

score: 0
Accepted
time: 602ms
memory: 59568kb

input:

500000
999967 999930 999954 999963 999981 999948 999979 999967 999967 1000000 999967 1000000 999964 999964 999930 999929 999964 999994 999930 1000000 999994 999930 999963 999967 999929 999948 1000000 999948 999948 999964 999979 999985 999979 999979 999985 999967 999930 999979 999979 999954 999967 99...

output:

5847955603692

result:

ok 1 number(s): "5847955603692"

Test #63:

score: 0
Accepted
time: 530ms
memory: 47516kb

input:

500000
998873 998624 999263 998627 999100 999683 998536 999294 998611 998639 999783 999491 999500 999503 999704 999382 998887 998585 999728 998958 999491 999258 998804 999704 999334 998498 999324 999236 999148 999056 999642 999334 999395 998800 999551 999732 998800 998962 998602 999474 999059 998570...

output:

202972266499420

result:

ok 1 number(s): "202972266499420"

Test #64:

score: 0
Accepted
time: 653ms
memory: 69912kb

input:

500000
999997 999995 999993 1000000 999996 999997 1000000 999997 999993 1000000 999993 999995 999993 999996 1000000 999993 1000000 1000000 999995 999993 999997 1000000 999997 999995 999996 999995 999996 1000000 1000000 999997 999996 999996 999997 999993 999997 999995 1000000 999995 999995 999996 999...

output:

999981600069

result:

ok 1 number(s): "999981600069"

Test #65:

score: 0
Accepted
time: 611ms
memory: 58232kb

input:

500000
999236 999236 999274 999832 999236 999274 999077 999274 999832 999405 999077 999832 999715 999236 999715 999274 999715 999236 999832 999715 999274 999405 999236 999274 999236 999832 999715 999832 999405 999715 999236 999274 999405 999715 999715 999832 999077 999405 999715 999715 999274 999274...

output:

77089959483420

result:

ok 1 number(s): "77089959483420"

Test #66:

score: 0
Accepted
time: 672ms
memory: 97328kb

input:

500000
1000000 999999 1000000 999999 999999 999999 1000000 999999 1000000 999999 1000000 999999 1000000 999999 1000000 999999 1000000 1000000 1000000 999999 999999 999999 1000000 999999 999999 1000000 1000000 999999 1000000 999999 1000000 999999 1000000 999999 999999 1000000 999999 999999 1000000 99...

output:

252996739003

result:

ok 1 number(s): "252996739003"

Test #67:

score: 0
Accepted
time: 693ms
memory: 97876kb

input:

500000
999993 999993 999994 999993 999994 999994 999993 999993 999994 999993 999993 999994 999994 999994 999993 999993 999993 999994 999993 999993 999993 999994 999993 999993 999993 999994 999994 999994 999993 999993 999993 999994 999994 999993 999993 999993 999993 999993 999994 999993 999994 999993...

output:

986826362634

result:

ok 1 number(s): "986826362634"

Test #68:

score: 0
Accepted
time: 591ms
memory: 97784kb

input:

500000
49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105 49105...

output:

80123

result:

ok 1 number(s): "80123"

Test #69:

score: 0
Accepted
time: 582ms
memory: 90044kb

input:

500000
745538 745538 50566 745538 745538 745538 50566 968898 968898 50566 50566 745538 968898 50566 50566 50566 745538 968898 50566 968898 745538 50566 968898 50566 968898 745538 968898 50566 50566 50566 745538 968898 968898 968898 968898 50566 745538 968898 50566 968898 968898 50566 745538 50566 96...

output:

98528105452

result:

ok 1 number(s): "98528105452"

Test #70:

score: 0
Accepted
time: 675ms
memory: 69092kb

input:

497123
163542 873313 889334 744243 825154 744243 825154 825154 744243 163542 873313 889334 889334 889334 744243 825154 825154 873313 163542 825154 873313 889334 744243 163542 889334 825154 744243 825154 873313 744243 163542 873313 889334 744243 825154 889334 873313 744243 889334 889334 825154 873313...

output:

527244750673

result:

ok 1 number(s): "527244750673"

Test #71:

score: 0
Accepted
time: 580ms
memory: 68724kb

input:

500000
66716 574417 235068 112448 155574 66716 155574 717201 66716 167592 478509 235068 235068 717201 717201 717201 167592 478509 205168 155574 235068 235068 155574 574417 155574 66716 167592 84833 155574 574417 112448 235068 478509 112448 235068 205168 167592 478509 717201 84833 112448 84833 167592...

output:

259631377515

result:

ok 1 number(s): "259631377515"

Test #72:

score: 0
Accepted
time: 609ms
memory: 50440kb

input:

500000
122239 180231 423679 212969 528151 930234 284403 962760 34915 229453 180231 942196 298573 785418 277452 284403 942196 785418 701867 180231 277452 962760 733402 212969 31877 966496 966496 259391 421851 180231 795763 243699 243699 152995 421851 212969 795763 243699 201292 298573 31877 229453 93...

output:

1512908432435

result:

ok 1 number(s): "1512908432435"

Test #73:

score: 0
Accepted
time: 406ms
memory: 90092kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

6327681876435

result:

ok 1 number(s): "6327681876435"

Test #74:

score: 0
Accepted
time: 480ms
memory: 52532kb

input:

500000
427467 598798 21542 829947 536086 677883 995211 482190 560882 9197 937563 415111 30563 253367 719273 902087 276262 909064 744323 143625 95306 17017 923967 447965 941509 239475 601780 641782 251070 587571 954336 225610 68956 852409 66248 370058 973217 372446 427084 406572 300703 229549 197361 ...

output:

75563411425434

result:

ok 1 number(s): "75563411425434"

Test #75:

score: 0
Accepted
time: 363ms
memory: 71488kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

419510893130276

result:

ok 1 number(s): "419510893130276"

Test #76:

score: 0
Accepted
time: 352ms
memory: 60496kb

input:

500000
858545 106130 590084 38597 495461 93845 518380 989129 136464 173124 331818 79790 225771 618807 710245 605522 194745 114230 335284 133546 534614 673245 28253 34351 472167 481474 549962 548643 386802 178063 587701 906337 39165 465587 690034 899414 842710 473441 290261 909876 815832 460806 74569...

output:

3283001930860768

result:

ok 1 number(s): "3283001930860768"

Test #77:

score: 0
Accepted
time: 640ms
memory: 53056kb

input:

500000
15 62500 3 1953 244 488 31250 250000 62500 3906 7 244 500000 15 250000 3906 488 15 244 31250 3906 1 250000 61 250000 1 7 976 15625 122 61 250000 31250 7 1 1 30 1 30 122 7812 244 31250 31250 31250 7 500000 1953 15 15625 3906 15625 500000 7 488 1953 250000 1953 488 7812 7812 125000 15 125000 62...

output:

50108521496

result:

ok 1 number(s): "50108521496"

Test #78:

score: 0
Accepted
time: 646ms
memory: 60948kb

input:

500000
152 5 457 5 37037 111111 333333 1000000 4115 12345 1 1 1 333333 333333 37037 1371 4115 1000000 50 333333 333333 1000000 12345 1000000 457 37037 16 4115 5 111111 37037 1371 5 1371 12345 5 111111 5 12345 1000000 1000000 152 4115 1371 1 50 457 12345 1000000 111111 111111 5 457 12345 4115 12345 1...

output:

28948043210

result:

ok 1 number(s): "28948043210"

Test #79:

score: 0
Accepted
time: 622ms
memory: 60336kb

input:

500000
1600 64 2 1000000 1000000 320 64 12 200000 12 2 320 1600 40000 40000 1000000 1600 2 1000000 8000 40000 64 8000 64 8000 320 40000 1000000 12 1600 40000 1600 40000 8000 200000 12 1600 320 1600 1600 2 200000 40000 320 40000 1600 2 64 1000000 1000000 1000000 64 1600 12 1600 1000000 40000 320 1000...

output:

17423415398

result:

ok 1 number(s): "17423415398"

Test #80:

score: 0
Accepted
time: 652ms
memory: 67852kb

input:

500000
100 100000 1000000 10000 1000 10000 1000 1000 1 1000000 100000 1000000 10000 1000000 100 10000 100000 1 100000 100000 100 100000 1 10000 10000 10000 1000000 1000 100000 10 10 100 1000000 1 100000 1000000 100 10000 100000 10 10 100 1000000 1 1000000 100000 10000 1000 100 10000 10000 100 100 10...

output:

8771963352

result:

ok 1 number(s): "8771963352"

Test #81:

score: 0
Accepted
time: 631ms
memory: 71248kb

input:

500000
11 3460 3460 11 203 1000000 58823 11 1000000 58823 58823 203 1000000 11 11 3460 58823 11 1000000 3460 3460 1000000 203 58823 1000000 1000000 1000000 1000000 11 1000000 203 1000000 203 1000000 1000000 58823 1000000 3460 1000000 203 58823 58823 203 203 1000000 1000000 1000000 3460 58823 3460 20...

output:

6644798388

result:

ok 1 number(s): "6644798388"

Test #82:

score: 0
Accepted
time: 587ms
memory: 92240kb

input:

500000
1 1000000 1000 1 1000000 1 1 1000000 1000000 1 1 1 1000 1000000 1 1000 1000 1000 1000000 1000000 1000 1 1000 1000 1000 1000000 1000 1000000 1000000 1000 1 1 1 1000000 1000 1000 1000 1 1000000 1000 1000 1000 1000 1 1000 1 1000 1000 1000 1000 1000000 1000000 1000000 1000000 1 1000000 1 1 1000 1...

output:

166293028

result:

ok 1 number(s): "166293028"

Test #83:

score: 0
Accepted
time: 515ms
memory: 47428kb

input:

500000
730 982 979 748 407 282 626 735 777 923 330 974 527 808 971 386 653 651 984 401 814 479 849 339 970 841 770 710 437 603 617 502 309 168 776 913 784 727 966 598 187 884 220 919 737 670 876 499 986 149 848 772 797 864 718 716 516 686 709 942 537 661 237 295 771 229 755 673 604 592 623 777 798 8...

output:

83099759214

result:

ok 1 number(s): "83099759214"

Test #84:

score: 0
Accepted
time: 538ms
memory: 47300kb

input:

500000
700 515 693 341 290 632 674 571 676 387 589 112 576 650 545 417 439 602 433 488 657 166 371 488 602 509 262 336 235 662 704 610 435 95 680 164 469 155 690 570 393 698 587 615 602 609 395 660 586 236 686 236 692 414 615 206 367 142 696 337 578 117 687 605 211 455 370 484 478 645 631 469 290 31...

output:

41617084541

result:

ok 1 number(s): "41617084541"

Test #85:

score: 0
Accepted
time: 543ms
memory: 46360kb

input:

500000
389 306 249 134 229 343 326 295 201 293 98 388 281 301 314 388 223 405 419 320 324 415 423 237 426 183 419 258 226 292 189 382 363 180 325 194 276 344 378 415 296 392 246 123 405 360 311 212 433 216 411 213 120 145 271 246 47 214 375 442 284 423 360 262 289 69 158 90 409 327 440 149 383 224 1...

output:

16733898154

result:

ok 1 number(s): "16733898154"

Test #86:

score: 0
Accepted
time: 570ms
memory: 47240kb

input:

500000
84 142 213 216 216 99 215 216 107 145 172 169 138 161 137 148 141 203 79 226 194 173 91 176 235 227 137 182 123 146 167 214 183 235 137 151 145 227 117 238 44 140 44 110 170 37 235 166 142 181 200 229 240 135 219 126 171 238 195 79 124 157 135 153 105 239 207 167 203 236 111 235 234 140 144 2...

output:

4902900761

result:

ok 1 number(s): "4902900761"

Test #87:

score: 0
Accepted
time: 607ms
memory: 49500kb

input:

500000
37 75 71 47 73 45 59 70 40 29 86 62 55 16 67 54 37 91 56 89 83 30 81 84 58 59 49 84 32 50 60 26 65 84 49 41 79 31 32 70 78 72 31 12 68 86 54 17 41 73 59 90 58 35 48 83 80 91 49 86 44 81 49 76 68 49 26 73 43 84 86 71 59 80 25 53 57 75 33 73 61 86 23 90 83 86 75 76 31 51 53 83 89 88 50 22 74 85...

output:

687571111

result:

ok 1 number(s): "687571111"

Test #88:

score: 0
Accepted
time: 635ms
memory: 68424kb

input:

500000
6 6 10 9 5 9 10 7 3 5 8 10 10 9 9 9 7 4 9 5 5 3 2 10 7 8 10 10 11 11 9 3 3 11 10 10 11 11 9 9 5 10 6 10 2 9 5 3 11 10 7 10 9 4 7 4 6 9 8 8 9 4 5 6 11 10 9 5 8 9 9 5 7 11 5 11 11 11 3 7 7 2 6 7 3 10 9 10 5 6 11 9 9 7 8 6 10 3 5 8 10 7 8 7 2 10 9 8 11 11 11 5 8 9 9 9 8 8 7 8 8 4 8 8 11 6 4 10 1...

output:

9899967

result:

ok 1 number(s): "9899967"

Test #89:

score: 0
Accepted
time: 112ms
memory: 42800kb

input:

102401
100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1...

output:

7424917

result:

ok 1 number(s): "7424917"

Test #90:

score: 0
Accepted
time: 112ms
memory: 42700kb

input:

102401
100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1...

output:

7424917

result:

ok 1 number(s): "7424917"

Test #91:

score: 0
Accepted
time: 110ms
memory: 42792kb

input:

102401
100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1...

output:

7424917

result:

ok 1 number(s): "7424917"

Test #92:

score: 0
Accepted
time: 112ms
memory: 42852kb

input:

102401
100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1...

output:

7424917

result:

ok 1 number(s): "7424917"

Extra Test:

score: 0
Extra Test Passed