QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#775210 | #9785. Shrooks | ucup-team087# | AC ✓ | 50ms | 63108kb | C++23 | 22.9kb | 2024-11-23 15:02:43 | 2024-11-23 15:02:43 |
Judging History
answer
#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#endif
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define int ll
bool dbg=false;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
using vvi=vc<vc<int>>;
template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
return os<<"{"<<p.a<<","<<p.b<<"}";
}
template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
os<<"{";
for(auto e:v)os<<e<<",";
return os<<"}";
}
#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
os<<t<<" ";
dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif
using uint=unsigned;
using ull=unsigned long long;
template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
return os<<vc<t>(all(a));
}
ll rand_int(ll l, ll r) { //[l, r]
//#ifdef LOCAL
static mt19937_64 gen;
/*#else
static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif*/
return uniform_int_distribution<ll>(l, r)(gen);
}
ll rand_int(ll k){ //[0,k)
return rand_int(0,k-1);
}
string rand_string(int n,char lw,char up){
string s(n,'?');
rep(i,n)s[i]=rand_int(lw,up);
return s;
}
int current_run_id,run_batch_size=1000;
int calc_random_limit(){
return current_run_id/run_batch_size+1;
}
template<class t>
void generate_single(t&a){
a=rand_int(1,calc_random_limit());
}
void generate_single(string&a){
int n;generate_single(n);
a=rand_string(n,'a','b');
}
template<class t,class u>
void generate_single(pair<t,u>&a){
generate_single(a.a);
generate_single(a.b);
}
//https://trap.jp/post/1224/
template<class... Args>
void input(Args&... a){
if(dbg){
(generate_single(a),...);
}else{
#ifdef USE_FAST_IO
sc.read(a...);
#else
(cin >> ... >> a);
#endif
}
}
#define INT(...) int __VA_ARGS__;input(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;input(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;input(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;input(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;input(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;input(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;input(__VA_ARGS__)
#define overload3(a,b,c,d,...) d
#define VI2(name,size) vi name(size);rep(i_##name,size)input(name[i_##name]);
#define VI3(name,size,offset) vi name(size);rep(i_##name,size)input(name[i_##name]),name[i_##name]+=offset;
#define VI(...) overload3(__VA_ARGS__,VI3,VI2)(__VA_ARGS__)
#define VPI(name,size) vc<pi> name(size);rep(i_##name,size)input(name[i_##name]);
#define VVI(name,sizeN,sizeM) vvi name(sizeN,vi(sizeM));\
rep(i_##name,sizeN)rep(j_##name,sizeM)input(name[i_##name][j_##name]);
#define VS(name,size) vc<string> name(size);rep(i_##name,size)input(name[i_##name]);
#define overload5(a,b,c,d,e,f,...) f
#define VVC4(type,name,sizeN,sizeM) vvc<type> name(sizeN,vc<type>(sizeM));
#define VVC5(type,name,sizeN,sizeM,ini) vvc<type> name(sizeN,vc<type>(sizeM,ini));
#define VVC(...) overload5(__VA_ARGS__,VVC5,VVC4)(__VA_ARGS__)
template<class T>
T vvvc(T v){
return v;
}
template<class T,class...Args>
auto vvvc(int n,T v,Args...args){
return vector(n,vvvc(v,args...));
}
template<int i,class T>
void print_tuple(ostream&,const T&){
}
template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
if(i)os<<",";
os<<get<i>(t);
print_tuple<i+1,T,Args...>(os,t);
}
template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
os<<"{";
print_tuple<0,tuple<Args...>,Args...>(os,t);
return os<<"}";
}
void printsuc(int suc){
#ifdef USE_FAST_IO
if(suc==1)pr.write('\n');
if(suc==2)pr.write(' ');
#else
if(suc==1){
if(dbg)cout<<endl;
else{
#ifdef LOCAL
cout<<endl;
#else
cout<<"\n";
#endif
}
}
if(suc==2)
cout<<" ";
#endif
}
template<class t>
void print_single(t x,int suc=1){
#ifdef USE_FAST_IO
pr.write(x);
#else
cout<<x;
#endif
printsuc(suc);
}
template<class t,class u>
void print_single(const pair<t,u>&p,int suc=1){
print_single(p.a,2);
print_single(p.b,suc);
}
template<class T>
void print_single(const vector<T>&v,int suc=1){
rep(i,v.size())
print_single(v[i],i==int(v.size())-1?3:2);
printsuc(suc);
}
template<class T,size_t N>
void print_single(const array<T,N>&v,int suc=1){
rep(i,N)
print_single(v[i],i==int(N)-1?3:2);
printsuc(suc);
}
template<class T>
void print(const T&t){
print_single(t);
}
template<class T,class ...Args>
void print(const T&t,const Args&...args){
print_single(t,2);
print(args...);
}
template<class T>
void printvv(const vvc<T>&vs){
for(const auto&row:vs)print(row);
}
string readString(){
string s;
cin>>s;
return s;
}
template<class T>
T sq(const T& t){
return t*t;
}
void YES(bool ex=true){
cout<<"YES\n";
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
void NO(bool ex=true){
cout<<"NO\n";
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
void Yes(bool ex=true){
cout<<"Yes\n";
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
void No(bool ex=true){
cout<<"No\n";
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
//#define CAPITAL
/*
void yes(bool ex=true){
#ifdef CAPITAL
cout<<"YES"<<"\n";
#else
cout<<"Yes"<<"\n";
#endif
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
void no(bool ex=true){
#ifdef CAPITAL
cout<<"NO"<<"\n";
#else
cout<<"No"<<"\n";
#endif
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}*/
void possible(bool ex=true){
#ifdef CAPITAL
cout<<"POSSIBLE"<<"\n";
#else
cout<<"Possible"<<"\n";
#endif
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
void impossible(bool ex=true){
#ifdef CAPITAL
cout<<"IMPOSSIBLE"<<"\n";
#else
cout<<"Impossible"<<"\n";
#endif
if(ex)exit(0);
#ifdef LOCAL
cout.flush();
#endif
}
constexpr ll ten(int n){
return n==0?1:ten(n-1)*10;
}
const ll infLL=LLONG_MAX/3;
#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif
int topbit(signed t){
return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
return t==0?-1:63-__builtin_clzll(t);
}
int topbit(ull t){
return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
return a==0?64:__builtin_ctzll(a);
}
int botbit(ull a){
return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
return __builtin_popcount(t);
}
int popcount(ll t){
return __builtin_popcountll(t);
}
int popcount(ull t){
return __builtin_popcountll(t);
}
int bitparity(ll t){
return __builtin_parityll(t);
}
bool ispow2(int i){
return i&&(i&-i)==i;
}
ll mask(int i){
return (ll(1)<<i)-1;
}
ull umask(int i){
return (ull(1)<<i)-1;
}
ll minp2(ll n){
if(n<=1)return 1;
else return ll(1)<<(topbit(n-1)+1);
}
bool inc(int a,int b,int c){
return a<=b&&b<=c;
}
template<class S> void mkuni(S&v){
sort(all(v));
v.erase(unique(all(v)),v.ed);
}
template<class t> bool isuni(vc<t> v){
int s=si(v);
mkuni(v);
return si(v)==s;
}
template<class t>
void myshuffle(vc<t>&a){
rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}
template<class S,class u>
int lwb(const S&v,const u&a){
return lower_bound(all(v),a)-v.bg;
}
template<class t,class u>
bool bis(const vc<t>&v,const u&a){
return binary_search(all(v),a);
}
//VERIFY: yosupo
//KUPC2017J
//AOJDSL1A
//without rank
struct unionfind{
vi p,s;
int c;
unionfind(int n):p(n,-1),s(n,1),c(n){}
void clear(){
fill(all(p),-1);
fill(all(s),1);
c=si(p);
}
int find(int a){
return p[a]==-1?a:(p[a]=find(p[a]));
}
//set b to a child of a
bool unite(int a,int b){
a=find(a);
b=find(b);
if(a==b)return false;
p[b]=a;
s[a]+=s[b];
c--;
return true;
}
bool same(int a,int b){
return find(a)==find(b);
}
int sz(int a){
return s[find(a)];
}
};
vvc<int> readGraph(int n,int m){
vvc<int> g(n);
rep(i,m){
int a,b;
cin>>a>>b;
//sc.read(a,b);
a--;b--;
g[a].pb(b);
g[b].pb(a);
}
return g;
}
vvc<int> rand_tree(int n){
vvc<int> t(n);
unionfind uf(n);
while(uf.c>1){
int a=rand_int(n);
int b=rand_int(n);
if(uf.unite(a,b)){
t[a].pb(b);
t[b].pb(a);
}
}
return t;
}
vvc<int> readTree(int n){
if(dbg){
return rand_tree(n);
}else{
return readGraph(n,n-1);
}
}
vi readRooted(int n){
assert(!dbg);
vi par(n,-1);
rng(i,1,n){
input(par[i]);
par[i]--;
assert(inc(0,par[i],i-1));
}
return par;
}
void printTree(const vvc<int> t){
int n=si(t);
int degsum=0;
rep(i,n)degsum+=si(t[i]);
if(degsum==n-1){
//directed
rep(i,si(t))for(auto j:t[i]){
print(i+1,j+1);
}
}else if(degsum==2*(n-1)){
//undirected
rep(i,si(t))for(auto j:t[i])if(i<j){
print(i+1,j+1);
}
}else{
assert(false);
}
}
template<class t>
vc<t> presum(const vc<t>&a){
vc<t> s(si(a)+1);
rep(i,si(a))s[i+1]=s[i]+a[i];
return s;
}
vc<ll> presum(const vi&a){
vc<ll> s(si(a)+1);
rep(i,si(a))s[i+1]=s[i]+a[i];
return s;
}
//BIT で数列を管理するときに使う (CF850C)
template<class t>
vc<t> predif(vc<t> a){
gnr(i,1,si(a))a[i]-=a[i-1];
return a;
}
template<class t>
vvc<ll> imos(const vvc<t>&a){
int n=si(a),m=si(a[0]);
vvc<ll> b(n+1,vc<ll>(m+1));
rep(i,n)rep(j,m)
b[i+1][j+1]=b[i+1][j]+b[i][j+1]-b[i][j]+a[i][j];
return b;
}
//verify してないや
void transvvc(int&n,int&m){
swap(n,m);
}
template<class t,class... Args>
void transvvc(int&n,int&m,vvc<t>&a,Args&...args){
assert(si(a)==n);
vvc<t> b(m,vi(n));
rep(i,n){
assert(si(a[i])==m);
rep(j,m)b[j][i]=a[i][j];
}
a.swap(b);
transvvc(n,m,args...);
}
//CF854E
void rotvvc(int&n,int&m){
swap(n,m);
}
template<class t,class... Args>
void rotvvc(int&n,int&m,vvc<t>&a,Args&...args){
assert(si(a)==n);
vvc<t> b(m,vi(n));
rep(i,n){
assert(si(a[i])==m);
rep(j,m)b[m-1-j][i]=a[i][j];
}
a.swap(b);
rotvvc(n,m,args...);
}
//ソートして i 番目が idx[i]
//CF850C
template<class t>
vi sortidx(const vc<t>&a){
int n=si(a);
vi idx(n);iota(all(idx),0);
sort(all(idx),[&](int i,int j){return a[i]<a[j];});
return idx;
}
//vs[i]=a[idx[i]]
//例えば sortidx で得た idx を使えば単にソート列になって返ってくる
//CF850C
template<class t>
vc<t> a_idx(const vc<t>&a,const vi&idx){
int n=si(a);
assert(si(idx)==n);
vc<t> vs(n);
rep(i,n)vs[i]=a[idx[i]];
return vs;
}
//CF850C
vi invperm(const vi&p){
int n=si(p);
vi q(n);
rep(i,n)q[p[i]]=i;
return q;
}
template<class t,class s=t>
s SUM(const vc<t>&a){
return accumulate(all(a),s(0));
}
template<class t,size_t K,class s=t>
s SUM(const array<t,K>&a){
return accumulate(all(a),s(0));
}
template<class t>
t MAX(const vc<t>&a){
return *max_element(all(a));
}
template<class t>
pair<t,int> MAXi(const vc<t>&a){
auto itr=max_element(all(a));
return mp(*itr,itr-a.bg);
}
template<class A>
auto MIN(const A&a){
return *min_element(all(a));
}
template<class t>
pair<t,int> MINi(const vc<t>&a){
auto itr=min_element(all(a));
return mp(*itr,itr-a.bg);
}
vi vid(int n){
vi res(n);iota(all(res),0);
return res;
}
template<class S>
void soin(S&s){
sort(all(s));
}
template<class S,class F>
void soin(S&s,F&&f){
sort(all(s),forward<F>(f));
}
template<class S>
S soout(S s){
soin(s);
return s;
}
template<class S>
void rein(S&s){
reverse(all(s));
}
template<class S>
S reout(S s){
rein(s);
return s;
}
template<class t,class u>
pair<t,u>&operator+=(pair<t,u>&a,pair<t,u> b){
a.a+=b.a;a.b+=b.b;return a;}
template<class t,class u>
pair<t,u>&operator-=(pair<t,u>&a,pair<t,u> b){
a.a-=b.a;a.b-=b.b;return a;}
template<class t,class u>
pair<t,u> operator+(pair<t,u> a,pair<t,u> b){return mp(a.a+b.a,a.b+b.b);}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a,pair<t,u> b){return mp(a.a-b.a,a.b-b.b);}
template<class t,class u,class v>
pair<t,u>&operator*=(pair<t,u>&a,v b){
a.a*=b;a.b*=b;return a;}
template<class t,class u,class v>
pair<t,u> operator*(pair<t,u> a,v b){return a*=b;}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a){return mp(-a.a,-a.b);}
namespace std{
template<class t,class u>
istream&operator>>(istream&is,pair<t,u>&a){
return is>>a.a>>a.b;
}
}
template<class t>
t gpp(vc<t>&vs){
assert(si(vs));
t res=move(vs.back());
vs.pop_back();
return res;
}
template<class t,class u>
void pb(vc<t>&a,const vc<u>&b){
a.insert(a.ed,all(b));
}
template<class t,class...Args>
vc<t> cat(vc<t> a,Args&&...b){
(pb(a,forward<Args>(b)),...);
return a;
}
template<class t,class u>
vc<t>& operator+=(vc<t>&a,u x){
for(auto&v:a)v+=x;
return a;
}
template<class t,class u>
vc<t> operator+(vc<t> a,u x){
return a+=x;
}
template<class t>
vc<t>& operator+=(vc<t>&a,const vc<t>&b){
a.resize(max(si(a),si(b)));
rep(i,si(b))a[i]+=b[i];
return a;
}
template<class t>
vc<t> operator+(const vc<t>&a,const vc<t>&b){
vc<t> c(max(si(a),si(b)));
rep(i,si(a))c[i]+=a[i];
rep(i,si(b))c[i]+=b[i];
return c;
}
template<class t,class u>
vc<t>& operator-=(vc<t>&a,u x){
for(auto&v:a)v-=x;
return a;
}
template<class t,class u>
vc<t> operator-(vc<t> a,u x){
return a-=x;
}
template<class t>
vc<t>& operator-=(vc<t>&a,const vc<t>&b){
a.resize(max(si(a),si(b)));
rep(i,si(b))a[i]-=b[i];
return a;
}
/*
template<class t>
vc<t> operator-(const vc<t>&a,const vc<t>&b){
vc<t> c(max(si(a),si(b)));
rep(i,si(a))c[i]+=a[i];
rep(i,si(b))c[i]-=b[i];
return c;
}
*/
template<class t,class u>
vc<t>& operator*=(vc<t>&a,u x){
for(auto&v:a)v*=x;
return a;
}
template<class t,class u>
vc<t> operator*(vc<t> a,u x){
return a*=x;
}
template<class t,class u>
vc<t>& operator/=(vc<t>&a,u x){
for(auto&v:a)v/=x;
return a;
}
template<class t,class u>
vc<t> operator/(vc<t> a,u x){
return a/=x;
}
template<class t>
vc<t>& operator<<=(vc<t>&a,int k){
assert(k>=0);
a.insert(a.bg,k,t(0));
return a;
}
template<class t>
vc<t> operator<<(vc<t> a,int k){
return a<<=k;
}
template<class t>
vc<t>& operator>>=(vc<t>&a,int k){
if(si(a)<=k)a.clear();
else a.erase(a.bg,a.bg+k);
return a;
}
template<class t>
vc<t> operator>>(vc<t> a,int k){
return a>>=k;
}
template<class t,class u>
void remval(vc<t>&a,const u&v){
a.erase(remove(all(a),v),a.ed);
}
//消した要素の個数を返してくれる
//UCUP 2-8-F
template<class t,class F>
int remif(vc<t>&a,F f){
auto itr=remove_if(all(a),f);
int res=a.ed-itr;
a.erase(itr,a.ed);
return res;
}
template<class t>
void rempos(vc<t>&a,int i){
assert(inc(0,i,si(a)-1));
a.erase(a.bg+i);
}
template<class VS,class u>
void fila(VS&vs,const u&a){
fill(all(vs),a);
}
template<class t,class u>
int findid(const vc<t>&vs,const u&a){
auto itr=find(all(vs),a);
if(itr==vs.ed)return -1;
else return itr-vs.bg;
}
template<class t>
void rtt(vc<t>&vs,int i){
rotate(vs.bg,vs.bg+i,vs.ed);
}
//Multiuni2023-8 C
//f(lw)=false,...,f(n-1)=false,f(n)=true,...,f(up)=true,
//のときに n を返す
template<class F>
int find_min_true(int lw,int up,F f){
while(up-lw>1){
const int mid=(lw+up)/2;
if(f(mid))up=mid;
else lw=mid;
}
return up;
}
//f(lw)=true,f(up)=false
template<class F>
int find_max_true(int lw,int up,F f){
while(up-lw>1){
const int mid=(lw+up)/2;
if(f(mid))lw=mid;
else up=mid;
}
return lw;
}
template<class t> using pqmin=priority_queue<t,vc<t>,greater<t>>;
template<class t> using pqmax=priority_queue<t>;
using T=tuple<int,int,int>;
//mint107 は verify してねえ
//#define DYNAMIC_MOD
struct modinfo{uint mod,root;
#ifdef DYNAMIC_MOD
constexpr modinfo(uint m,uint r):mod(m),root(r),im(0){set_mod(m);}
ull im;
constexpr void set_mod(uint m){
mod=m;
im=ull(-1)/m+1;
}
uint product(uint a,uint b)const{
ull z=ull(a)*b;
uint x=((unsigned __int128)z*im)>>64;
uint v=uint(z)-x*mod;
return v<mod?v:v+mod;
}
#endif
};
template<modinfo const&ref>
struct modular{
static constexpr uint const &mod=ref.mod;
static modular root(){return modular(ref.root);}
uint v;
//modular(initializer_list<uint>ls):v(*ls.bg){}
modular(ll vv=0){s(vv%mod+mod);}
modular& s(uint vv){
v=vv<mod?vv:vv-mod;
return *this;
}
modular operator-()const{return modular()-*this;}
modular& operator+=(const modular&rhs){return s(v+rhs.v);}
modular&operator-=(const modular&rhs){return s(v+mod-rhs.v);}
modular&operator*=(const modular&rhs){
#ifndef DYNAMIC_MOD
v=ull(v)*rhs.v%mod;
#else
v=ref.product(v,rhs.v);
#endif
return *this;
}
modular&operator/=(const modular&rhs){return *this*=rhs.inv();}
modular operator+(const modular&rhs)const{return modular(*this)+=rhs;}
modular operator-(const modular&rhs)const{return modular(*this)-=rhs;}
modular operator*(const modular&rhs)const{return modular(*this)*=rhs;}
modular operator/(const modular&rhs)const{return modular(*this)/=rhs;}
modular pow(ll n)const{
if(n<0)return inv().pow(-n);
modular res(1),x(*this);
while(n){
if(n&1)res*=x;
x*=x;
n>>=1;
}
return res;
}
modular inv()const{return pow(mod-2);}
/*modular inv()const{
int x,y;
int g=extgcd<ll>(v,mod,x,y);
assert(g==1);
if(x<0)x+=mod;
return modular(x);
}*/
friend modular operator+(ll x,const modular&y){
return modular(x)+y;
}
friend modular operator-(ll x,const modular&y){
return modular(x)-y;
}
friend modular operator*(ll x,const modular&y){
return modular(x)*y;
}
friend modular operator/(ll x,const modular&y){
return modular(x)/y;
}
friend ostream& operator<<(ostream&os,const modular&m){
return os<<m.v;
}
friend istream& operator>>(istream&is,modular&m){
ll x;is>>x;
m=modular(x);
return is;
}
bool operator<(const modular&r)const{return v<r.v;}
bool operator==(const modular&r)const{return v==r.v;}
bool operator!=(const modular&r)const{return v!=r.v;}
explicit operator bool()const{
return v;
}
};
#ifndef DYNAMIC_MOD
extern constexpr modinfo base{998244353,3};
//extern constexpr modinfo base{1000000007,0};
//extern constexpr modinfo base{2147483579,1689685080};//2^31 未満の最大の安全素数
//modinfo base{1,0};
#ifdef USE_GOOD_MOD
static_assert(base.mod==998244353);
#endif
#else
modinfo base(1,0);
extern constexpr modinfo base107(1000000007,0);
using mint107=modular<base107>;
#endif
using mint=modular<base>;
mint parity(int i){
return i%2==0?1:-1;
}
#ifdef LOCAL
const int vmax=10010;
#else
const int vmax=(1<<21)+10;
#endif
mint fact[vmax],finv[vmax],invs[vmax];
void initfact(){
const int s=min<int>(vmax,base.mod);
fact[0]=1;
rng(i,1,s){
fact[i]=fact[i-1]*i;
}
finv[s-1]=fact[s-1].inv();
for(int i=s-2;i>=0;i--){
finv[i]=finv[i+1]*(i+1);
}
for(int i=s-1;i>=1;i--){
invs[i]=finv[i]*fact[i-1];
}
}
mint choose(int n,int k){
return inc(0,k,n)?fact[n]*finv[n-k]*finv[k]:0;
}
mint binom(int a,int b){
return 0<=a&&0<=b?fact[a+b]*finv[a]*finv[b]:0;
}
mint catalan(int n){
return binom(n,n)-(n-1>=0?binom(n-1,n+1):0);
}
//対角線を超えず (x,y) に至る方法の数
mint catalan(int x,int y){
assert(y<=x);
return binom(x,y)-binom(x+1,y-1);
}
//y=x+c を超えず (x,y) に至る方法の数
mint catalan(int x,int y,int c){
assert(y<=x+c);
return binom(x,y)-binom(x+c+1,y-c-1);
}
/*
const int vmax=610;
mint fact[vmax+1],binbuf[vmax+1][vmax+1];
mint choose(int n,int k){
return 0<=k&&k<=n?binbuf[n-k][k]:0;
}
mint binom(int a,int b){
return 0<=a&&0<=b?binbuf[a][b]:0;
}
void initfact(int n){
fact[0]=1;
rep(i,n)fact[i+1]=fact[i]*(i+1);
rep(i,n+1)rep(j,n+1){
if(i==0&&j==0){
binbuf[i][j]=1;
}else{
binbuf[i][j]=0;
if(i)binbuf[i][j]+=binbuf[i-1][j];
if(j)binbuf[i][j]+=binbuf[i][j-1];
}
}
}
*/
mint p2[vmax],p2inv[vmax];
void initp2(){
p2[0]=1;
rep(i,vmax-1)p2[i+1]=p2[i]*2;
p2inv[vmax-1]=p2[vmax-1].inv();
per(i,vmax-1)p2inv[i]=p2inv[i+1]*2;
}
int m2i(mint a){
uint v=a.v;
return v<mint::mod/2?v:int(v)-int(mint::mod);
}
pi m2f(mint x){
pi res(inf,inf);
auto upd=[&](int a,int b){
if(abs(res.a)+res.b>abs(a)+b){
res=pi(a,b);
}
};
rng(b,1,1000){
mint y=x*b;
upd(y.v,b);
upd(-int((-y).v),b);
}
return res;
}
void slv(){
INT(n);
VI(a,n,-1);//-2!!
vi avail(n,1);
rep(i,n)if(a[i]>=0)avail[a[i]]=0;
vi asum=presum(avail);
vvc<pi> buf(n);
auto query=[&](int xl,int xr,int yl,int yr)->mint{
rep(i,n)buf[i].clear();
rep(row,n){
int l=max<int>({0,xl-row,yl+row});
int r=min<int>({n-1,xr-row,yr+row});
if(r<l)return 0;
if(a[row]>=0){
if(!inc(l,a[row],r))return 0;
}else{
buf[r-l].eb(l,r);
}
}
int prel=inf,prer=-inf;
int used=0;
mint ans=1;
rep(w,n)for(auto [l,r]:buf[w]){
assert(l<=prel);
assert(prer<=r);
prel=l;
prer=r;
int cnt=asum[r+1]-asum[l];
ans*=cnt-used;
used++;
}
return ans;
};
mint ans=0;
if(n%2==0){
int k=n/2;
int xl=k-1,xr=k-1+n,yl=-k,yr=-k+n;
ans+=query(xl+0,xr+0,yl+0,yr+0);
ans+=query(xl-1,xr-1,yl+0,yr+0);
ans-=query(xl+0,xr-1,yl+0,yr+0);
ans+=query(xl+1,xr+1,yl+0,yr+0);
ans-=query(xl+1,xr+0,yl+0,yr+0);
ans+=query(xl+0,xr+0,yl-1,yr-1);
ans-=query(xl+0,xr+0,yl+0,yr-1);
ans+=query(xl+0,xr+0,yl+1,yr+1);
ans-=query(xl+0,xr+0,yl+1,yr+0);
}else{
int k=n/2;
int xl=k-1,xr=k-1+n,yl=-k-1,yr=-k-1+n;
ans+=query(xl+0,xr+0,yl+0,yr+0);
ans-=query(xl+1,xr+0,yl+0,yr+0);
ans+=query(xl+1,xr+1,yl+0,yr+0);
ans-=query(xl+1,xr+1,yl+1,yr+0);
ans+=query(xl+1,xr+1,yl+1,yr+1);
ans-=query(xl+1,xr+0,yl+1,yr+1);
ans+=query(xl+0,xr+0,yl+1,yr+1);
ans-=query(xl+0,xr+0,yl+1,yr+0);
}
print(ans);
}
signed main(signed argc,char*argv[]){
if(argc>1&&strcmp(argv[1],"D")==0)dbg=true;
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
if(dbg){
while(1){
if(current_run_id%run_batch_size==0){
cerr<<"Current Run "<<current_run_id<<endl;
}
slv();
current_run_id++;
}
}else{
int t;cin>>t;rep(_,t)
slv();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 14ms
memory: 44840kb
input:
6 2 1 2 3 -1 -1 -1 4 1 -1 -1 -1 5 1 -1 -1 -1 5 6 3 -1 -1 -1 -1 4 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
output:
1 4 1 0 6 92
result:
ok 6 numbers
Test #2:
score: 0
Accepted
time: 13ms
memory: 44544kb
input:
6 2 1 2 3 -1 -1 -1 4 1 -1 -1 -1 5 1 -1 -1 -1 5 6 3 -1 -1 -1 -1 4 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
output:
1 4 1 0 6 92
result:
ok 6 numbers
Test #3:
score: 0
Accepted
time: 41ms
memory: 44564kb
input:
26874 7 -1 -1 7 1 5 3 -1 7 -1 -1 5 3 6 -1 7 7 -1 7 -1 2 3 6 -1 7 -1 2 7 1 5 3 -1 7 3 -1 2 6 1 4 -1 7 4 -1 5 6 1 -1 3 7 -1 -1 4 -1 7 2 -1 7 -1 6 -1 5 4 3 -1 7 6 7 1 2 5 4 -1 7 -1 5 -1 4 2 3 6 7 -1 4 3 5 7 6 -1 7 6 -1 -1 -1 7 5 -1 7 -1 -1 2 -1 4 -1 3 7 -1 -1 2 -1 6 -1 4 7 -1 5 6 2 7 4 -1 7 -1 -1 6 -1 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 2 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3 0 0 0 0 0 5 0 0 1 0 0 0 0 0 0 0 0 1 0 0 3 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 0 ...
result:
ok 26874 numbers
Test #4:
score: 0
Accepted
time: 35ms
memory: 44512kb
input:
26874 7 3 -1 2 1 5 4 -1 7 3 5 4 -1 1 -1 -1 7 4 -1 3 2 7 5 -1 7 -1 -1 1 7 5 2 -1 7 -1 -1 -1 -1 5 4 3 7 5 -1 2 -1 7 4 -1 7 -1 3 -1 6 7 1 5 7 7 1 5 -1 4 -1 -1 7 5 -1 -1 7 -1 -1 4 7 -1 5 4 7 -1 6 -1 7 6 -1 7 -1 3 -1 5 7 -1 5 6 -1 1 -1 3 7 -1 1 3 2 -1 -1 -1 7 -1 4 2 3 1 -1 5 7 -1 4 1 5 -1 -1 2 7 7 6 4 5 ...
output:
0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 2 0 0 ...
result:
ok 26874 numbers
Test #5:
score: 0
Accepted
time: 42ms
memory: 44784kb
input:
625 8 -1 -1 -1 -1 -1 -1 -1 -1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 12 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
44 60 92 124 188 252 380 508 764 1020 1532 2044 3068 4092 6140 8188 12284 16380 24572 32764 49148 65532 98300 131068 196604 262140 393212 524284 786428 1048572 1572860 2097148 3145724 4194300 6291452 8388604 12582908 16777212 25165820 33554428 50331644 67108860 100663292 134217724 201326588 26843545...
result:
ok 625 numbers
Test #6:
score: 0
Accepted
time: 47ms
memory: 44872kb
input:
97 2000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
69678827 92905104 139357658 185810212 278715320 371620428 557430644 743240860 116616939 488237371 233233882 976474746 466467768 954705143 932935540 911165937 867626731 824087525 737009113 649930701 475773877 301617053 951547758 603234110 904851167 208223871 811457985 416447746 624671621 832895496 25...
result:
ok 97 numbers
Test #7:
score: 0
Accepted
time: 49ms
memory: 62956kb
input:
1 199999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
78278419
result:
ok 1 number(s): "78278419"
Test #8:
score: 0
Accepted
time: 47ms
memory: 63104kb
input:
1 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 ...
output:
616539807
result:
ok 1 number(s): "616539807"
Test #9:
score: 0
Accepted
time: 50ms
memory: 44644kb
input:
10000 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 10 24 -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 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 10 8 -1 6 -1 ...
output:
0 12284 0 4092 32 4095 0 128 0 0 764 158 256 2044 764 1 1 0 4095 1020 1022 3068 2 32 16382 16380 318 26 318 1020 1532 128 16 0 24572 2044 4092 4 2 6140 12284 8188 6140 2 508 764 8190 1 1023 1532 510 2044 1 63 380 64 2044 0 6140 3068 8 2044 256 2 32 383 4092 4 3068 0 6140 1532 32 8188 6140 380 6140 4...
result:
ok 10000 numbers
Test #10:
score: 0
Accepted
time: 44ms
memory: 44632kb
input:
10000 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 7 6 -1 -1 -1 2 -1 -1 1 19 -1 -1 16 15 14 -1 -1 -1 16 -1 -1 -1 -1 13 3 15 1 16 2 14 4 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 21 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
252 3068 32 16 254 4092 1532 0 188 4092 1020 2044 8188 1 64 2 380 158 16380 0 191 8 0 0 1020 8191 131070 6140 32 510 256 0 0 12284 6140 4092 4 2047 128 128 1 7166 16 2 6140 0 8 1024 2044 8188 4 2558 0 128 2 1 8188 764 6140 1 0 128 30 49148 62 0 12284 508 127 638 16 1 380 0 4095 8 0 32 1 4095 256 4 4...
result:
ok 10000 numbers
Test #11:
score: 0
Accepted
time: 44ms
memory: 44792kb
input:
10000 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 22 -1 -1 14 15 -1 6 -1 -1 -1 -1 22 1 -1 3 4 5 -1 -1 8 -1 -1 -1 27 -1 -1 -1 -1 -1 -1 -1 -1 22 -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 -1 ...
output:
2044 2044 16 8191 3068 2046 512 1020 16383 65534 4094 4092 1023 1 508 2 4092 16 6140 764 6140 639 0 1023 0 0 3068 8190 6140 128 60 0 128 2 508 2046 0 8 4092 64 1 32 6140 190 2 0 764 0 6140 16 8 0 8188 32 0 0 512 764 0 32 8 1 0 2044 0 2047 4092 32766 764 1 1022 128 8191 0 32 24572 128 0 32 764 49148 ...
result:
ok 10000 numbers
Test #12:
score: 0
Accepted
time: 36ms
memory: 44592kb
input:
10000 24 -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 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 23 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 25 12 11 10 -1 -1 19 -1 5 4 3 2 1 25 24 -1 22 -1 20 7 8 17 -1 15 14 -1 26 -1 -1 -1 -...
output:
12284 3068 8188 1 24572 255 6140 24572 32764 2 1 3068 511 32 4092 255 0 393212 512 380 254 3068 1020 638 0 0 2044 256 64 524284 128 64 8 4094 1020 2044 32 254 8188 382 766 1020 128 1 0 1024 4 6140 2044 12284 3068 4092 16380 1020 38 8 0 64 393212 4094 49148 508 8188 2048 38 767 512 6140 128 1 2 64 32...
result:
ok 10000 numbers
Test #13:
score: 0
Accepted
time: 41ms
memory: 44672kb
input:
10000 25 -1 -1 -1 17 -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 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 15 -1 -1 -1 -1 -1 -1 -1 24 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 17 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -...
output:
3071 1532 254 12284 1020 764 256 0 6140 511 0 0 2 12287 3068 0 64 4 32 8188 32764 0 1022 62 764 0 3068 0 2044 1023 128 508 252 32 64 319 1 8 0 64 252 16380 8188 48 32 24572 1532 4 3068 16 1020 0 0 188 4 2046 124 2047 126 131068 1023 4092 1532 2047 4 0 0 95 2047 1024 382 6140 0 1 64 6140 6140 16380 0...
result:
ok 10000 numbers
Test #14:
score: 0
Accepted
time: 38ms
memory: 44632kb
input:
10000 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 20 -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 -1 -1 -1 -1 10 -1 25 -1 -1 -1 -1 -1 -1 -1 -1 23 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 25 -1 -1 -1 -1 -1 -1 -1 5 -1 -1 -1 -1 25 -1 -1 -...
output:
508 3068 128 0 1024 6140 0 32 262140 128 4092 6140 252 0 1532 3068 0 124 0 16 3068 16380 158 4 1532 0 1020 1532 0 2 1020 0 0 318 127 32 8190 126 0 1 0 0 508 3068 4092 0 12284 65532 764 0 4092 0 0 1532 4096 1023 6140 1 188 128 4094 256 64 79 1532 512 2047 638 0 128 6140 1023 382 764 64 32 0 8188 256 ...
result:
ok 10000 numbers
Test #15:
score: 0
Accepted
time: 44ms
memory: 44868kb
input:
10000 17 -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 -1 -1 -1 -1 11 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 17 -1 8 11 -1 13 4 -1 -1 1 17 16 3 -1 -1 6 -1 10 16 -1 10 11 5 -1 -1 -1 1 16 2 1...
output:
0 2044 64 0 1 1 8188 0 1532 6140 188 32 0 0 508 766 1024 4092 0 64 3068 1020 3068 0 764 188 32768 0 2 318 0 0 8 1020 764 8188 4092 1 0 638 1020 1532 2044 158 8191 6140 3068 0 3068 511 188 0 1022 0 6140 32 0 32767 8 511 508 319 4 190 1 32766 2 0 2 0 128 63 2048 380 1023 32764 54 128 2044 0 188 511 20...
result:
ok 10000 numbers
Test #16:
score: 0
Accepted
time: 45ms
memory: 44584kb
input:
10000 22 12 10 -1 -1 -1 -1 -1 -1 3 2 -1 -1 21 20 -1 -1 -1 -1 8 14 13 11 25 -1 11 10 -1 -1 18 19 -1 -1 -1 2 -1 -1 1 23 22 4 -1 6 -1 -1 -1 15 -1 12 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 14 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6 15 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16 -1 ...
output:
32 8 128 32 508 64 3068 1020 0 0 16380 1024 511 510 2046 127 2048 4096 0 6140 64 2046 12284 764 2046 3068 32 16 1 8188 508 1023 4092 252 47 8 0 16380 2 0 16380 1020 511 64 512 766 31 0 0 0 256 764 0 64 8188 2 16383 0 8 1024 1023 256 0 8188 1020 4 188 508 4092 0 64 1023 2558 1020 3068 380 0 128 0 153...
result:
ok 10000 numbers
Test #17:
score: 0
Accepted
time: 40ms
memory: 44668kb
input:
10000 22 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 18 9 -1 -1 6 14 15 3 -1 -1 18 -1 16 4 -1 13 7 8 10 20 10 9 -1 7 15 5 17 18 19 -1 20 -1 -1 4 16 6 14 13 12 11 20 -1 -1 -1 -1 -1 -1 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 22 11 -1 -1 -1 -1 6 -1 -1 -1 21 1 -1 -1 -1 -1 -1 -1 1...
output:
6140 2 1 256 16 0 508 380 0 0 1020 16380 32 0 764 64 2046 512 131068 1022 0 0 4096 188 383 256 2047 65532 64 318 256 6140 1020 0 2044 24572 1 4095 128 0 764 8190 32 4 0 64 65532 1022 0 24572 254 8 3068 0 8192 3068 2 1023 6140 256 32 64 1532 2047 8 255 766 1532 128 32 3068 0 49148 8 2047 32 16380 163...
result:
ok 10000 numbers
Test #18:
score: 0
Accepted
time: 41ms
memory: 44580kb
input:
10000 18 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 9 -1 -1 17 -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 -1 -1 -1 -1 -1 -1 13 -1 -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 28 14 -1 12 -1 10 -1 -1 -1 23 -1 4 3 27 -1 1 2 26 25 5 6 -1 -1 20 19 -1 17 -1 15 26 -1...
output:
0 1020 1532 0 16 24572 1022 0 1023 764 8 32 0 64 3068 0 1 2048 4092 1532 508 255 32764 1020 512 4095 2 0 1532 16 0 3068 3068 128 1023 1532 764 2047 2047 64 764 511 4 2047 2 256 764 254 16 31 1 3068 4095 64 1532 8 3068 4 16 4 4 126 2047 1020 4 6140 6140 1 2044 126 0 256 128 6140 1023 1 158 0 0 0 6140...
result:
ok 10000 numbers
Test #19:
score: 0
Accepted
time: 36ms
memory: 44876kb
input:
100 1996 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
687744635 196839516 755489666 69678827 951547758 266201546 185810214 371620428 976474749 476174913 801889856 230806092 159566486 0 0 0 279868367 875030000 149467963 930820825 784037796 510735315 49696824 0 461612191 70796466 672579723 0 506334863 159566489 230806092 379887494 608503959 88733846 1175...
result:
ok 100 numbers
Test #20:
score: 0
Accepted
time: 35ms
memory: 44828kb
input:
100 1938 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
0 371620432 911165941 976474750 970972875 601722871 0 196839516 454654153 379887494 349151410 266247384 57701524 28850761 603234113 0 557430644 228803765 133490394 98419756 0 79783245 427011595 416447750 83501095 687744631 0 911243614 687744635 862346803 637113048 189943748 133490394 0 617122664 615...
result:
ok 100 numbers
Test #21:
score: 0
Accepted
time: 39ms
memory: 44844kb
input:
100 2066 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
834862697 23226273 278715320 116616939 601315941 884598617 0 3765090 556575133 301617053 0 230806092 436222071 1882545 759774995 759774995 923224380 25059058 758831532 371620428 233233882 0 673697878 266247384 446368374 363466540 436222071 759774995 754489833 185810215 44366921 0 266247384 687744634...
result:
ok 100 numbers
Test #22:
score: 0
Accepted
time: 31ms
memory: 44844kb
input:
100 1972 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
141418137 120595093 731696071 603234110 811457985 689435486 427011599 0 0 770952885 324744552 0 196839516 0 687744631 0 523142607 635424006 375929777 537692343 0 23226277 133123690 455621807 500292333 668008760 754489833 0 875054260 44366921 773184442 240965760 0 0 929481727 0 6151231 77140333 69816...
result:
ok 100 numbers
Test #23:
score: 0
Accepted
time: 31ms
memory: 45032kb
input:
100 2047 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
0 386592219 46452550 141418137 743240864 0 0 848204411 182583049 940453896 621987768 667546643 466025955 272277747 0 14425380 0 266247384 278287563 268906116 569831243 689435486 624671621 562027925 0 842994493 358616606 817223464 0 444595123 731696071 0 156102147 45813225 0 904851167 0 479292266 954...
result:
ok 100 numbers
Test #24:
score: 0
Accepted
time: 31ms
memory: 44840kb
input:
100 2008 1004 1003 1002 1001 -1 1010 -1 -1 996 -1 -1 1016 992 991 990 -1 988 1022 986 1024 1025 983 1027 981 980 979 978 1032 976 975 1035 973 972 -1 1039 969 -1 -1 966 -1 964 963 1047 -1 960 959 -1 -1 956 1054 1055 -1 1057 1058 -1 1060 1061 947 -1 1064 944 -1 1067 -1 1069 1070 1071 -1 -1 1074 -1 -1...
output:
608858250 421497243 988759971 796722578 450247064 371620431 875687385 603234112 869067658 79639131 371620428 233233882 24604936 442978742 44366925 86552282 832895496 0 43276139 398084597 933360445 817550116 867626731 709870796 466467768 603234112 784037796 0 0 196009446 768629076 823522459 638265956...
result:
ok 100 numbers
Test #25:
score: 0
Accepted
time: 35ms
memory: 45028kb
input:
100 1955 -1 -1 -1 982 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1051 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 893 -1 -1 890 -1 -1 -1 -1 -1 -1 1...
output:
663616721 723193849 676115973 0 976474746 69678827 796169198 827018326 931277135 840250283 649930705 69678827 548124535 228803765 230806094 527847872 32375512 799780147 772454936 92905104 576471803 0 0 49777186 642586216 208223871 0 398361287 556575134 993502162 371620428 12723609 759774992 0 532403...
result:
ok 100 numbers
Test #26:
score: 0
Accepted
time: 31ms
memory: 44880kb
input:
100 2079 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
0 772454932 0 133490394 115403048 613524059 569831243 796722581 23226273 0 12302466 698164477 379887496 98419756 976474746 752289608 88733846 709870796 643710771 745182733 0 310458197 421497246 875687385 699747052 0 759774992 906455299 484916460 502197790 0 393679036 743240863 0 0 130397105 30161705...
result:
ok 100 numbers
Test #27:
score: 0
Accepted
time: 40ms
memory: 44776kb
input:
100 2014 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
932935540 0 687744631 16187756 23226277 951547758 0 398084597 0 951547758 539063199 208223871 336848941 637113048 879190462 534470978 46452553 461612188 0 820977562 356313984 233233882 698164473 919247316 651336739 49209876 177467696 133123690 334010009 24604936 346209140 823626258 832895496 7432408...
result:
ok 100 numbers
Test #28:
score: 0
Accepted
time: 39ms
memory: 44836kb
input:
100 2084 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
201119824 848204411 954705146 185810215 23226276 559736730 848204411 0 421497246 608341720 0 718919792 398361287 260380120 239349731 768629075 114905915 349151411 92905104 630377599 336848940 288586625 0 23226273 540872724 286928079 96081722 336848937 210709411 773184442 0 837180163 50279953 9846086...
result:
ok 100 numbers
Test #29:
score: 0
Accepted
time: 37ms
memory: 57676kb
input:
1 199916 99959 99960 99961 99962 99954 99964 99965 -1 99950 -1 -1 -1 -1 99945 99973 99974 -1 99976 -1 -1 99979 99937 -1 -1 -1 99933 -1 -1 99987 -1 -1 -1 99991 99925 -1 -1 99995 -1 99997 99919 -1 -1 99916 -1 -1 -1 -1 99911 100007 100008 99908 -1 -1 99905 99904 99903 -1 100016 -1 100018 -1 -1 -1 99895...
output:
173961957
result:
ok 1 number(s): "173961957"
Test #30:
score: 0
Accepted
time: 44ms
memory: 62948kb
input:
1 199961 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
0
result:
ok 1 number(s): "0"
Test #31:
score: 0
Accepted
time: 36ms
memory: 62964kb
input:
1 199957 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
672756062
result:
ok 1 number(s): "672756062"
Test #32:
score: 0
Accepted
time: 28ms
memory: 56632kb
input:
1 199906 -1 99955 -1 99957 99958 99948 -1 99946 99962 -1 -1 99965 -1 99967 99939 -1 -1 99971 99972 -1 99933 -1 -1 -1 99929 99928 99980 99981 -1 99983 -1 -1 99921 99920 99919 -1 99990 -1 99992 99914 99994 99912 99911 -1 99998 -1 99907 -1 -1 -1 99903 -1 -1 99900 -1 -1 -1 100011 -1 100013 100014 99892 ...
output:
634868560
result:
ok 1 number(s): "634868560"
Test #33:
score: 0
Accepted
time: 41ms
memory: 63108kb
input:
1 199954 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
501844609
result:
ok 1 number(s): "501844609"
Test #34:
score: 0
Accepted
time: 50ms
memory: 62984kb
input:
1 199922 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
458110054
result:
ok 1 number(s): "458110054"
Test #35:
score: 0
Accepted
time: 34ms
memory: 58088kb
input:
1 199964 99983 -1 99985 99979 99987 99988 -1 -1 -1 99973 -1 99994 99995 99969 99997 -1 -1 100000 99964 -1 99962 -1 99960 99959 -1 99957 -1 -1 99954 99953 -1 99951 -1 100016 -1 -1 -1 -1 -1 100022 100023 -1 -1 -1 99938 -1 100029 99935 99934 99933 -1 -1 -1 -1 99928 99927 100039 100040 99924 99923 -1 -1...
output:
444173461
result:
ok 1 number(s): "444173461"
Test #36:
score: 0
Accepted
time: 37ms
memory: 62440kb
input:
1 199932 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
556130586
result:
ok 1 number(s): "556130586"
Test #37:
score: 0
Accepted
time: 30ms
memory: 56900kb
input:
1 199991 -1 99994 99993 99992 -1 99990 -1 -1 -1 -1 -1 99984 -1 -1 100011 99980 100013 -1 100015 -1 99975 -1 99973 -1 99971 99970 -1 -1 -1 -1 -1 -1 -1 99962 -1 100032 -1 -1 100035 -1 -1 99954 -1 -1 99951 100042 99949 99948 -1 100046 100047 -1 -1 -1 -1 -1 100053 -1 -1 -1 -1 -1 99933 -1 -1 -1 100063 -1...
output:
779998139
result:
ok 1 number(s): "779998139"
Test #38:
score: 0
Accepted
time: 35ms
memory: 62884kb
input:
1 199992 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
849607271
result:
ok 1 number(s): "849607271"
Test #39:
score: 0
Accepted
time: 42ms
memory: 62908kb
input:
1 199980 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
527524180
result:
ok 1 number(s): "527524180"
Test #40:
score: 0
Accepted
time: 46ms
memory: 62948kb
input:
1 199926 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
0
result:
ok 1 number(s): "0"
Test #41:
score: 0
Accepted
time: 36ms
memory: 63012kb
input:
1 199957 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
667311192
result:
ok 1 number(s): "667311192"
Test #42:
score: 0
Accepted
time: 48ms
memory: 63044kb
input:
1 199947 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
956877704
result:
ok 1 number(s): "956877704"
Test #43:
score: 0
Accepted
time: 31ms
memory: 62952kb
input:
1 199935 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
826024747
result:
ok 1 number(s): "826024747"
Test #44:
score: 0
Accepted
time: 35ms
memory: 57620kb
input:
1 199980 99991 -1 99988 99994 -1 -1 -1 99983 99982 100000 99980 -1 -1 100004 100005 99975 99974 -1 -1 99971 100011 99969 -1 -1 -1 100016 -1 -1 100019 99961 -1 -1 99958 100024 -1 99955 100027 99953 -1 -1 -1 99949 -1 99947 -1 -1 100037 -1 99942 100040 -1 99939 99938 99937 100045 -1 -1 -1 99932 -1 -1 -...
output:
177136763
result:
ok 1 number(s): "177136763"
Test #45:
score: 0
Accepted
time: 30ms
memory: 56364kb
input:
1 199962 -1 99980 -1 -1 99977 -1 99975 99989 99990 99972 99992 99970 99994 -1 99996 99997 99965 -1 100000 99962 -1 99960 -1 -1 100006 99956 100008 99954 99953 100011 100012 99950 -1 99948 -1 -1 99945 -1 -1 -1 99941 100023 99939 99938 100026 100027 99935 99934 100030 99932 99931 99930 100034 100035 9...
output:
465650177
result:
ok 1 number(s): "465650177"
Test #46:
score: 0
Accepted
time: 48ms
memory: 62884kb
input:
1 199965 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -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:
781653522
result:
ok 1 number(s): "781653522"
Test #47:
score: 0
Accepted
time: 35ms
memory: 55904kb
input:
1 199986 -1 99995 99996 99990 99998 -1 -1 -1 99985 -1 -1 100005 100006 100007 99979 -1 100010 -1 99975 99974 99973 -1 -1 100017 -1 99968 100020 100021 99965 -1 99963 100025 99961 99960 -1 99958 100030 100031 -1 100033 -1 -1 100036 99950 99949 -1 100040 99946 99945 100043 99943 99942 100046 100047 -1...
output:
53217606
result:
ok 1 number(s): "53217606"
Test #48:
score: 0
Accepted
time: 42ms
memory: 58396kb
input:
1 199948 99975 -1 -1 -1 -1 99980 -1 -1 99983 -1 -1 99963 -1 99961 -1 99959 -1 99957 -1 -1 -1 -1 99997 -1 -1 -1 -1 -1 100003 -1 -1 100006 -1 -1 -1 100010 -1 -1 -1 -1 -1 99933 -1 99931 -1 99929 -1 99927 -1 99925 -1 100026 99922 -1 -1 -1 -1 -1 100033 100034 -1 -1 -1 99911 -1 99909 -1 99907 -1 -1 -1 100...
output:
644437797
result:
ok 1 number(s): "644437797"
Extra Test:
score: 0
Extra Test Passed