QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#323831 | #8231. Festival Decorating | ucup-team087# | AC ✓ | 2811ms | 59148kb | C++20 | 26.5kb | 2024-02-10 13:37:46 | 2024-10-20 19:52:56 |
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
#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>;
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));
}
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<<"}";
}
ll read(){
ll i;
cin>>i;
return i;
}
vi readvi(int n,int off=0){
vi v(n);
rep(i,n)v[i]=read()+off;
return v;
}
pi readpi(int off=0){
int a,b;cin>>a>>b;
return pi(a+off,b+off);
}
template<class t>
void print_single(t x,int suc=1){
cout<<x;
if(suc==1)
cout<<"\n";
if(suc==2)
cout<<" ";
}
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?suc:2);
}
template<class T>
void print_offset(const vector<T>&v,ll off,int suc=1){
rep(i,v.size())
print_single(v[i]+off,i==int(v.size())-1?suc:2);
}
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?suc:2);
}
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...);
}
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 t> void mkuni(vc<t>&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;
}
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);
}
template<class t>
void myshuffle(vc<t>&a){
rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}
template<class t,class u>
int lwb(const vc<t>&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);
}
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> readTree(int n){
return readGraph(n,n-1);
}
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>
pair<t,u> operator-(pair<t,u> a){return mp(-a.a,-a.b);}
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+(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>
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 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);
}
//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;
}
};
#define USE_GOOD_MOD
//size of input must be a power of 2
//output of forward fmt is bit-reversed
//output elements are in the range [0,mod*4)
//input of inverse fmt should be bit-reversed
template<class mint>
void inplace_fmt(const int n,mint*const f,bool inv){
static constexpr uint mod=mint::mod;
static constexpr uint mod2=mod*2;
static constexpr int L=30;
static mint g[L],ig[L],p2[L];
if(g[0].v==0){
rep(i,L){
mint w=-mint::root().pow(((mod-1)>>(i+2))*3);
g[i]=w;
ig[i]=w.inv();
p2[i]=mint(1<<i).inv();
}
}
if(!inv){
int b=n;
if(b>>=1){//input:[0,mod)
rep(i,b){
uint x=f[i+b].v;
f[i+b].v=f[i].v+mod-x;
f[i].v+=x;
}
}
if(b>>=1){//input:[0,mod*2)
mint p=1;
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
while(b){
if(b>>=1){//input:[0,mod*3)
mint p=1;
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
if(b>>=1){//input:[0,mod*4)
mint p=1;
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j].v=(f[j].v<mod2?f[j].v:f[j].v-mod2);
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
}
}else{
int b=1;
if(b<n/2){//input:[0,mod)
mint p=1;
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
ull x=f[j].v+mod-f[j+b].v;
f[j].v+=f[j+b].v;
f[j+b].v=x*p.v%mod;
}
p*=ig[__builtin_ctz(++k)];
}
b<<=1;
}
for(;b<n/2;b<<=1){
mint p=1;
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b/2){//input:[0,mod*2)
ull x=f[j].v+mod2-f[j+b].v;
f[j].v+=f[j+b].v;
f[j].v=(f[j].v)<mod2?f[j].v:f[j].v-mod2;
f[j+b].v=x*p.v%mod;
}
rng(j,i+b/2,i+b){//input:[0,mod)
ull x=f[j].v+mod-f[j+b].v;
f[j].v+=f[j+b].v;
f[j+b].v=x*p.v%mod;
}
p*=ig[__builtin_ctz(++k)];
}
}
if(b<n){//input:[0,mod*2)
rep(i,b){
uint x=f[i+b].v;
f[i+b].v=f[i].v+mod2-x;
f[i].v+=x;
}
}
mint z=p2[__lg(n)];
rep(i,n)f[i]*=z;
}
}
template<class mint>
void inplace_fmt(vector<mint>&f,bool inv){
inplace_fmt(si(f),f.data(),inv);
}
//size of input must be a power of 2
//output elements are in the range [0,mod*4)
template<class mint>
void half_fmt(const int n,mint*const f){
static constexpr uint mod=mint::mod;
static constexpr uint mod2=mod*2;
static const int L=30;
static mint g[L],h[L];
if(g[0].v==0){
rep(i,L){
g[i]=-mint::root().pow(((mod-1)>>(i+2))*3);
h[i]=mint::root().pow((mod-1)>>(i+2));
}
}
int b=n;
int lv=0;
if(b>>=1){//input:[0,mod)
mint p=h[lv++];
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
if(b>>=1){//input:[0,mod*2)
mint p=h[lv++];
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
while(b){
if(b>>=1){//input:[0,mod*3)
mint p=h[lv++];
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
if(b>>=1){//input:[0,mod*4)
mint p=h[lv++];
for(int i=0,k=0;i<n;i+=b*2){
rng(j,i,i+b){
uint x=(f[j+b]*p).v;
f[j].v=(f[j].v<mod2?f[j].v:f[j].v-mod2);
f[j+b].v=f[j].v+mod-x;
f[j].v+=x;
}
p*=g[__builtin_ctz(++k)];
}
}
}
}
template<class mint>
void half_fmt(vector<mint>&f){
half_fmt(si(f),f.data());
}
#ifdef USE_GOOD_MOD
template<class mint>
vc<mint> multiply(vc<mint> x,const vc<mint>&y,bool same=false){
int n=si(x)+si(y)-1;
int s=1;
while(s<n)s*=2;
x.resize(s);inplace_fmt(x,false);
if(!same){
static vc<mint> z;
z.clear();z.resize(s);
rep(i,si(y))z[i]=y[i];
inplace_fmt(z,false);
rep(i,s)x[i]*=z[i];
}else{
rep(i,s)x[i]*=x[i];
}
inplace_fmt(x,true);x.resize(n);
return x;
}
template<class mint>
vc<mint> multiply_givenlength(vc<mint> x,const vc<mint>&y,bool same=false){
int s=si(x);
assert(ispow2(s));
assert(si(y));
x.resize(s);inplace_fmt(x,false);
if(!same){
static vc<mint> z;
z.clear();z.resize(s);
rep(i,si(y))z[i]=y[i];
inplace_fmt(z,false);
rep(i,s)x[i]*=z[i];
}else{
rep(i,s)x[i]*=x[i];
}
inplace_fmt(x,true);
return x;
}
#else
//59501818244292734739283969-1=5.95*10^25 までの値を正しく計算
//最終的な列の大きさが 2^24 までなら動く
//最終的な列の大きさが 2^20 以下のときは,下の 3 つの素数を使ったほうが速い(は?)
//VERIFY: yosupo
//Yukicoder No980 (same=true)
namespace arbitrary_convolution{
constexpr modinfo base0{167772161,3};//2^25 * 5 + 1
constexpr modinfo base1{469762049,3};//2^26 * 7 + 1
constexpr modinfo base2{754974721,11};//2^24 * 45 + 1
//extern constexpr modinfo base0{1045430273,3};//2^20 * 997 + 1
//extern constexpr modinfo base1{1051721729,6};//2^20 * 1003 + 1
//extern constexpr modinfo base2{1053818881,7};//2^20 * 1005 + 1
using mint0=modular<base0>;
using mint1=modular<base1>;
using mint2=modular<base2>;
template<class t,class mint>
vc<t> sub(const vc<mint>&x,const vc<mint>&y,bool same=false){
int n=si(x)+si(y)-1;
int s=1;
while(s<n)s*=2;
vc<t> z(s);rep(i,si(x))z[i]=x[i].v;
inplace_fmt(z,false);
if(!same){
vc<t> w(s);rep(i,si(y))w[i]=y[i].v;
inplace_fmt(w,false);
rep(i,s)z[i]*=w[i];
}else{
rep(i,s)z[i]*=z[i];
}
inplace_fmt(z,true);z.resize(n);
return z;
}
template<class mint>
vc<mint> multiply(const vc<mint>&x,const vc<mint>&y,bool same=false){
auto d0=sub<mint0>(x,y,same);
auto d1=sub<mint1>(x,y,same);
auto d2=sub<mint2>(x,y,same);
int n=si(d0);
vc<mint> res(n);
static const mint1 r01=mint1(mint0::mod).inv();
static const mint2 r02=mint2(mint0::mod).inv();
static const mint2 r12=mint2(mint1::mod).inv();
static const mint2 r02r12=r02*r12;
static const mint w1=mint(mint0::mod);
static const mint w2=w1*mint(mint1::mod);
rep(i,n){
ull a=d0[i].v;
ull b=(d1[i].v+mint1::mod-a)*r01.v%mint1::mod;
ull c=((d2[i].v+mint2::mod-a)*r02r12.v+(mint2::mod-b)*r12.v)%mint2::mod;
res[i].v=(a+b*w1.v+c*w2.v)%mint::mod;
}
return res;
}
template<class t,class mint>
vc<t>&sub_givenlength(const vc<mint>&x,const vc<mint>&y,bool same=false){
int s=si(x);
assert(ispow2(s));
assert(si(y)==s);
static vc<t> z;
z.clear();z.resize(s);
rep(i,si(x))z[i]=x[i].v;
inplace_fmt(z,false);
if(!same){
static vc<t> w;
w.clear();w.resize(s);
rep(i,si(y))w[i]=y[i].v;
inplace_fmt(w,false);
rep(i,s)z[i]*=w[i];
}else{
rep(i,s)z[i]*=z[i];
}
inplace_fmt(z,true);
return z;
}
template<class mint>
vc<mint> multiply_givenlength(vc<mint> x,const vc<mint>&y,bool same=false){
auto&d0=sub_givenlength<mint0>(x,y,same);
auto&d1=sub_givenlength<mint1>(x,y,same);
auto&d2=sub_givenlength<mint2>(x,y,same);
int n=si(d0);
x.resize(n);
static const mint1 r01=mint1(mint0::mod).inv();
static const mint2 r02=mint2(mint0::mod).inv();
static const mint2 r12=mint2(mint1::mod).inv();
static const mint2 r02r12=r02*r12;
static const mint w1=mint(mint0::mod);
static const mint w2=w1*mint(mint1::mod);
rep(i,n){
ull a=d0[i].v;
ull b=(d1[i].v+mint1::mod-a)*r01.v%mint1::mod;
ull c=((d2[i].v+mint2::mod-a)*r02r12.v+(mint2::mod-b)*r12.v)%mint2::mod;
x[i].v=(a+b*w1.v+c*w2.v)%mint::mod;
}
return x;
}
}
using arbitrary_convolution::multiply;
using arbitrary_convolution::multiply_givenlength;
#endif
//UTPC2021 C
namespace integer_convolution{
extern constexpr modinfo base0{1045430273,3};//2^20 * 997 + 1
extern constexpr modinfo base1{1051721729,6};//2^20 * 1003 + 1
//extern constexpr modinfo base0{469762049,3};//2^26 * 7 + 1
//extern constexpr modinfo base1{754974721,11};//2^24 * 45 + 1
using mint0=modular<base0>;
using mint1=modular<base1>;
template<class t>
vc<t> sub(const vi&x,const vi&y,bool same=false){
int n=si(x)+si(y)-1;
int s=1;
while(s<n)s*=2;
vc<t> z(s);rep(i,si(x))z[i]=x[i];
inplace_fmt(z,false);
if(!same){
vc<t> w(s);rep(i,si(y))w[i]=y[i];
inplace_fmt(w,false);
rep(i,s)z[i]*=w[i];
}else{
rep(i,s)z[i]*=z[i];
}
inplace_fmt(z,true);z.resize(n);
return z;
}
vi multiply(const vi&x,const vi&y,bool same=false){
auto d0=sub<mint0>(x,y,same);
auto d1=sub<mint1>(x,y,same);
const mint1 r=mint1(mint0::mod).inv();
const ll v=ll(mint0::mod)*mint1::mod;
int n=si(d0);
vi res(n);
rep(i,n){
res[i]=d0[i].v+(r*(d1[i]-d0[i].v)).v*(ull)mint0::mod;
if(res[i]>v/2)res[i]-=v;
}
return res;
}
}
//最大で 1<<mx のサイズの fft が登場!
template<class mint>
vc<mint> large_convolution(const vc<mint>&a,const vc<mint>&b,int mx){
int n=si(a),m=si(b);
vc<mint> c(n+m-1);
int len=1<<(mx-1);
for(int i=0;i<n;i+=len){
for(int j=0;j<n;j+=len){
int x=min(len,n-i),y=min(len,m-j);
auto d=multiply(vc<mint>(a.bg+i,a.bg+i+x),vc<mint>(b.bg+j,b.bg+j+y));
rep(k,si(d))
c[i+j+k]+=d[k];
}
}
return c;
}
//input A: N 次,B ?,M
//output D: M 次多項式
//C を M 次多項式として
//[x^N] A*B*C = [x^M] D*C
//となるような D を返す
//CF796F
template<class mint>
vc<mint> transpose_advance(const vc<mint>&a,const vc<mint>&b,int m){
int n=si(a)-1;
auto d=multiply(a,b);
vc<mint> res(m+1);
if(n>=m){
rep(i,m+1)res[i]=d[i+n-m];
}else{
rng(i,m-n,m+1)res[i]=d[i+n-m];
}
return res;
}
//Yukicoder 2166
template<class mint>
void chmult(vc<mint>&x,const vc<mint>&y,int s){
x=multiply(move(x),y);
x.resize(s);
}
#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(){
fact[0]=1;
rng(i,1,vmax){
fact[i]=fact[i-1]*i;
}
finv[vmax-1]=fact[vmax-1].inv();
for(int i=vmax-2;i>=0;i--){
finv[i]=finv[i+1]*(i+1);
}
for(int i=vmax-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;
}
bool dbg=false;
void slv(){
int n,q;cin>>n>>q;
vc<pi> xc(n);
int s=0;
rep(i,n){
cin>>xc[i].a>>xc[i].b;
xc[i].b--;
chmax(s,xc[i].a);
}
vi ds=readvi(q);
chmax(s,MAX(ds));
vi ans(q,inf);
vc<mint> buf(n),x,y,z;
for(int len=1;;len*=2){
chmin(len,n);
rep(phase,2){
rep(i,n)buf[i]=rand_int(mint::mod);
z.assign(s+1,0);
{
x.assign(s+1,0);
y.assign(s+1,0);
rep(i,len){
x[s-xc[i].a]+=sq(buf[xc[i].b]);
}
rep(i,n){
y[xc[i].a]+=1;
}
chmult(x,y,s*2+1);
rep(i,s+1)
z[i]+=x[i+s];
}
{
x.assign(s+1,0);
y.assign(s+1,0);
rep(i,len){
x[s-xc[i].a]+=1;
}
rep(i,n){
y[xc[i].a]+=sq(buf[xc[i].b]);
}
chmult(x,y,s*2+1);
rep(i,s+1)
z[i]+=x[i+s];
}
{
x.assign(s+1,0);
y.assign(s+1,0);
rep(i,len){
x[s-xc[i].a]+=buf[xc[i].b];
}
rep(i,n){
y[xc[i].a]+=(-2)*buf[xc[i].b];
}
chmult(x,y,s*2+1);
rep(i,s+1)
z[i]+=x[i+s];
}
rep(i,q)if(z[ds[i]]){
chmin(ans[i],len/2+1);
}
}
if(len==n)break;
}
for(auto v:ans)print(v%inf);
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
if(dbg){
while(1)slv();
}else{
//int t;cin>>t;rep(_,t)
slv();
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 11ms
memory: 44664kb
input:
4 5 3 1 1 2 5 1 6 2 1 2 3 4 5
output:
3 2 1 2 0
result:
ok 5 numbers
Test #2:
score: 0
Accepted
time: 1022ms
memory: 48832kb
input:
10000 99999 67296 2 19835 1 93435 1 12756 2 38971 2 58322 2 4419 1 58583 1 68865 1 14192 1 66909 1 31419 2 40656 2 60289 2 79053 1 82880 1 28930 2 46115 1 9805 1 45096 2 29874 1 37171 2 55385 2 69812 1 16845 2 36030 2 58316 1 53401 1 35239 1 40363 1 29811 2 46440 2 98911 1 86466 2 9707 1 41909 2 616...
output:
33 65 9 33 65 5 3 33 9 2 2 17 17 33 3 9 33 3 65 2 65 2 2 5 17 5 9 33 17 65 9 65 9 9 9 3 17 9 9 65 17 5 17 9 9 5 9 3 17 9 33 9 33 9 33 9 9 33 33 17 17 33 17 33 9 3 9 9 9 17 17 2 33 5 65 33 33 17 9 5 17 1 17 2 9 9 9 17 17 9 17 5 5 33 33 5 3 17 3 3 17 33 3 9 33 9 65 65 33 33 9 33 17 9 5 65 65 3 5 17 9 ...
result:
ok 99999 numbers
Test #3:
score: 0
Accepted
time: 1060ms
memory: 49024kb
input:
30000 99999 51883 1 2142 1 69096 2 63011 1 70418 2 56529 1 65292 2 28901 2 78364 1 96477 1 43396 2 84388 1 29343 2 41141 2 94692 1 91222 1 30872 2 17288 2 11547 1 81095 2 16542 1 38652 1 54120 2 83684 2 70599 1 55085 1 91457 1 37800 1 46297 1 81164 1 79807 2 58484 1 43670 1 7180 2 58437 1 96924 2 63...
output:
2 1 3 17 5 9 9 5 3 3 1 5 3 5 9 3 9 1 5 3 1 3 9 9 5 1 9 3 1 2 5 5 1 2 17 9 17 5 1 5 1 2 5 5 5 5 2 3 3 2 9 9 9 2 3 5 3 3 9 2 9 17 5 5 1 3 3 17 5 3 3 3 5 17 3 3 3 5 5 9 9 5 5 9 5 9 1 5 5 3 1 9 17 9 3 2 5 3 3 9 5 9 1 5 9 5 5 1 1 9 3 5 1 3 1 5 2 2 3 5 3 9 5 9 5 1 3 3 5 9 2 5 9 3 5 1 3 5 5 5 17 5 17 2 5 5...
result:
ok 99999 numbers
Test #4:
score: 0
Accepted
time: 2572ms
memory: 56036kb
input:
100000 249999 101558 1 226768 2 215012 1 223802 2 3723 1 154951 1 95152 1 188191 2 128933 2 30706 1 141077 1 8377 2 160084 2 56011 1 11556 1 233668 2 42420 2 78212 1 245580 1 25824 2 61180 1 178193 2 179736 1 25607 2 160052 2 56056 2 93163 1 206849 2 28049 2 120634 2 44385 1 188594 1 195761 2 143744...
output:
9 5 3 1 2 2 9 3 2 3 9 5 1 5 2 5 17 1 3 3 9 1 1 3 2 17 9 3 1 2 9 3 3 1 1 9 3 3 1 1 5 5 1 9 1 5 3 3 17 5 1 5 1 5 2 9 5 1 1 9 3 5 5 9 5 9 2 1 5 3 2 2 5 3 3 1 9 1 9 5 3 9 2 1 5 3 3 2 1 3 1 3 1 2 9 2 5 2 2 5 5 5 1 5 5 2 5 3 2 3 3 2 2 5 1 5 3 5 5 1 3 1 3 5 1 5 2 5 1 5 5 3 3 1 5 1 2 1 9 17 2 2 1 2 1 17 3 2...
result:
ok 249999 numbers
Test #5:
score: 0
Accepted
time: 2750ms
memory: 57044kb
input:
150000 249999 29678 2 204012 1 242341 1 55873 2 133195 1 191930 2 158651 2 118376 2 166685 2 52303 2 77713 1 201614 2 135192 2 195257 1 42453 1 42856 1 205245 1 86911 2 192969 1 30106 1 78525 2 140326 2 144700 1 42186 1 215224 2 19113 2 160246 1 159685 1 10602 1 137178 1 102450 1 137587 2 171123 2 1...
output:
1 5 2 1 2 1 5 5 5 3 3 3 2 3 9 2 3 5 5 1 2 1 2 5 9 2 1 3 3 2 3 1 1 5 5 5 1 3 5 5 2 1 1 5 5 2 1 1 2 1 2 2 9 5 1 3 1 9 2 2 5 5 3 1 9 1 5 9 1 3 2 3 3 3 5 1 9 2 2 3 3 1 5 3 5 2 3 2 5 3 1 1 1 2 3 5 5 1 1 2 2 2 1 5 1 5 5 3 5 5 1 9 3 1 1 5 2 5 3 1 9 1 1 2 1 3 2 3 3 3 1 3 3 3 1 3 1 1 1 3 1 9 3 3 1 2 3 5 1 9 ...
result:
ok 249999 numbers
Test #6:
score: 0
Accepted
time: 2787ms
memory: 58028kb
input:
200000 249999 6248 1 183259 1 153451 2 85616 1 114994 2 98565 1 151656 1 220307 1 178381 2 11378 2 229267 2 229745 2 121994 2 127081 1 49355 1 227953 2 110071 1 227824 1 18185 2 140762 2 98797 1 3337 1 229512 2 31126 2 180753 1 206940 1 130823 2 115947 2 201783 1 113674 2 155525 2 112976 2 66144 1 1...
output:
2 3 3 3 3 1 2 2 3 3 1 5 1 1 1 1 1 3 9 3 3 1 3 2 2 1 1 1 3 2 3 2 1 3 1 2 1 1 1 1 2 3 3 1 1 1 5 1 3 1 2 2 9 3 2 1 3 2 1 3 1 1 2 2 5 3 1 1 1 1 3 1 5 5 2 1 2 1 3 2 1 1 1 2 1 1 1 3 5 1 1 1 2 2 1 1 1 3 1 1 3 1 2 3 3 3 2 3 5 3 1 1 2 2 5 2 3 2 1 2 5 2 1 1 3 1 3 1 5 1 1 1 3 1 5 3 1 1 2 1 1 2 2 1 2 1 1 2 1 5 ...
result:
ok 249999 numbers
Test #7:
score: 0
Accepted
time: 2811ms
memory: 59084kb
input:
250000 249999 43395 2 176047 2 182604 2 174584 1 84087 1 171284 2 62939 2 167394 1 91843 1 6316 1 172364 1 60476 1 137969 2 164958 1 49683 2 230414 1 106627 1 120532 1 245073 2 179049 2 34146 2 88698 1 150706 1 99450 1 241792 2 70708 1 69060 2 175739 1 38005 2 65970 1 66335 2 182109 1 32837 1 71265 ...
output:
1 1 2 1 3 1 1 2 2 2 1 5 3 2 1 1 3 1 1 1 2 2 3 5 2 1 1 2 2 1 3 2 3 3 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 5 2 1 3 5 2 1 1 2 3 2 1 3 2 1 1 1 1 1 3 2 1 2 1 3 1 1 1 2 1 2 1 2 2 1 5 2 1 1 1 2 1 1 2 1 3 1 1 2 3 1 3 3 2 3 1 2 3 1 1 2 1 1 2 3 1 1 1 2 3 2 1 1 1 2 1 1 2 1 1 1 2 3 1 1 5 1 3 1 2 1 2 3 9 1 2 1 1 1 1 ...
result:
ok 249999 numbers
Test #8:
score: 0
Accepted
time: 2567ms
memory: 56068kb
input:
100000 249999 15193 3 145839 3 79432 1 108888 2 236993 3 238864 2 96951 2 249086 3 46743 1 32398 3 138017 3 52120 2 230778 2 21656 3 62564 3 208611 2 108357 1 235637 2 247827 1 247624 2 128781 2 13021 1 55702 2 43874 1 126878 2 177432 3 30826 3 100406 3 7564 1 201946 2 52522 3 249872 1 79661 3 13976...
output:
5 9 2 1 2 1 3 9 2 3 3 2 3 1 3 1 9 1 2 3 5 5 5 2 1 2 5 9 3 2 1 1 3 1 17 1 1 1 3 1 5 9 2 1 3 5 9 1 1 3 2 1 1 3 5 2 3 1 2 2 9 1 1 3 3 3 1 3 2 1 1 3 1 3 1 1 1 2 5 3 3 5 5 3 1 3 2 9 3 3 9 1 3 5 3 3 2 5 2 2 3 3 3 2 1 9 3 1 1 3 1 17 3 9 3 1 2 2 1 1 1 1 2 5 1 3 1 2 2 3 17 5 3 1 3 2 5 1 5 2 3 3 1 5 3 9 1 3 3...
result:
ok 249999 numbers
Test #9:
score: 0
Accepted
time: 2741ms
memory: 57044kb
input:
150000 249999 151797 3 132264 2 228119 2 62624 3 122655 1 93048 2 120758 3 96298 1 127189 3 79578 1 233029 1 166678 2 73775 2 132317 2 51322 1 6343 1 176933 2 106261 1 36493 2 159428 3 112870 3 117448 3 93008 1 154295 2 190828 2 74969 1 240852 1 46624 2 241429 3 65645 1 212721 2 110548 2 118236 2 20...
output:
2 1 1 2 2 3 1 2 3 3 2 3 5 3 2 1 2 3 2 2 1 5 1 5 3 1 2 1 1 1 1 2 1 2 3 5 2 1 2 1 9 3 3 1 5 5 1 9 3 1 1 1 3 2 2 1 3 3 1 2 3 1 1 2 5 1 3 3 2 1 3 1 1 3 1 1 1 1 2 1 1 1 1 3 1 1 2 3 1 3 2 1 2 1 1 5 3 3 3 1 2 1 3 3 3 5 1 1 3 2 2 3 3 1 1 3 1 3 1 2 2 3 3 1 2 5 1 5 2 2 2 2 3 2 3 1 1 3 2 1 3 2 3 3 1 3 1 5 2 2 ...
result:
ok 249999 numbers
Test #10:
score: 0
Accepted
time: 2743ms
memory: 58028kb
input:
200000 249999 47041 3 73295 1 221000 1 53265 2 201031 3 222816 2 231867 2 175711 2 150407 1 172427 1 241001 2 192843 2 13671 1 231028 3 208391 2 171533 2 166545 2 97954 3 192317 2 208872 1 231857 1 113741 1 219000 1 192008 3 112701 1 244639 3 224948 1 13585 2 184997 1 179230 3 149300 1 169950 1 9416...
output:
3 1 1 3 3 1 2 3 3 3 2 2 1 2 1 1 1 1 1 1 3 1 1 3 1 3 2 2 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 1 3 3 5 1 1 5 2 1 1 1 2 2 1 1 2 1 2 1 1 1 1 1 5 1 2 1 2 1 1 1 3 1 5 2 2 2 3 2 3 2 1 3 1 2 1 1 1 1 3 1 3 3 2 1 1 2 1 1 5 2 3 1 1 1 1 1 1 3 2 1 3 3 1 1 1 2 3 1 2 2 2 1 1 2 5 5 3 2 1 2 2 1 2 1 1 1 1 2 1 1 1 5 1 2 1 ...
result:
ok 249999 numbers
Test #11:
score: 0
Accepted
time: 2778ms
memory: 58964kb
input:
250000 249999 18119 2 48006 3 232814 2 214885 3 10886 3 761 1 28565 2 127342 3 100481 2 91912 2 169408 3 198992 3 32749 2 20324 3 32474 1 38005 2 240939 2 215900 2 200682 1 432 1 5669 3 84940 3 56161 1 203677 1 241950 1 113041 1 138836 3 153159 3 81938 1 61416 3 239183 2 180390 3 83045 3 107312 1 22...
output:
2 1 1 1 3 2 1 1 2 2 2 1 1 3 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 3 1 1 1 2 1 1 3 1 1 3 1 3 3 2 1 2 3 2 1 1 2 5 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 5 1 1 3 1 3 1 3 2 1 1 3 1 1 2 5 1 1 2 1 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 2 1 1 1 1 1 1 ...
result:
ok 249999 numbers
Test #12:
score: 0
Accepted
time: 2582ms
memory: 56016kb
input:
100000 249999 224336 2 97421 4 237741 10 33517 3 217556 5 236052 6 13864 5 189562 1 209432 1 150833 7 94408 10 220716 3 83847 9 61678 7 95666 3 36542 1 162104 1 158517 6 33248 8 43402 1 18134 8 112042 9 202559 9 183144 6 24872 6 27758 7 217309 8 73017 1 59520 9 187721 10 100252 6 138484 7 165554 7 1...
output:
5 9 5 1 1 5 1 3 5 2 1 3 5 2 9 3 3 1 2 2 3 3 3 1 1 5 2 5 3 3 3 2 3 2 5 2 2 1 5 1 1 5 1 3 2 1 1 2 1 1 1 2 2 1 9 1 5 1 3 1 3 5 3 1 5 2 1 1 1 5 9 1 9 2 3 3 2 3 2 2 2 3 2 1 1 2 17 2 5 2 1 2 2 1 5 3 1 3 2 2 2 2 1 3 2 1 17 1 2 3 5 3 1 2 1 2 1 1 1 3 1 1 1 1 1 5 1 1 1 2 1 1 1 2 2 1 3 3 1 1 2 2 1 1 2 1 3 2 1 ...
result:
ok 249999 numbers
Test #13:
score: 0
Accepted
time: 2707ms
memory: 56960kb
input:
150000 249999 166792 6 238330 4 84379 10 131925 6 168914 7 96461 6 127762 9 204071 4 243519 8 198906 6 161831 7 131281 8 115061 10 69493 4 208817 9 4190 10 195480 10 51511 6 80200 5 81104 6 131338 8 100895 2 207427 4 237681 3 206143 4 224139 6 17948 8 228982 10 200256 8 36233 9 146742 6 162442 2 165...
output:
1 3 2 2 2 1 1 1 1 1 2 1 2 3 1 5 2 2 1 1 5 1 2 5 1 1 2 2 1 2 1 2 2 1 3 5 1 1 1 1 1 1 2 1 5 2 2 2 3 1 1 1 1 2 3 1 2 9 5 1 1 1 1 2 2 1 5 1 1 1 2 1 2 1 1 1 1 1 2 2 2 1 2 2 5 2 1 1 1 1 3 2 1 2 1 1 2 1 1 1 1 1 3 1 1 1 2 9 3 2 3 1 1 3 3 2 1 2 3 3 1 2 3 1 2 2 1 3 2 2 1 1 2 1 1 1 1 2 2 1 1 1 3 1 1 2 1 1 1 1 ...
result:
ok 249999 numbers
Test #14:
score: 0
Accepted
time: 2734ms
memory: 58112kb
input:
200000 249999 200627 8 155259 8 116629 3 7460 8 212178 2 236426 2 247999 4 58552 9 226174 3 136423 3 68187 1 223717 1 115991 3 96943 9 99300 3 196487 3 82852 9 21321 8 146283 2 173037 8 22904 7 198079 10 22919 1 95543 6 237838 2 248787 7 186160 8 201677 8 44573 7 55166 3 60479 6 247478 2 247081 10 3...
output:
1 1 1 1 1 2 1 1 1 1 3 1 1 1 3 1 2 1 1 1 1 1 1 1 2 3 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 3 1 1 1 1 1 1 1 2 1 5 1 2 1 1 1 1 2 1 3 1 1 2 1 2 3 1 1 1 2 1 1 1 1 1 2 1 1 2 2 1 2 1 1 2 1 1 1 3 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 2 2 2 1 1 2 2 2 1 1 2 1 1 1 1 1 1 1 1 2 2 1 3 1 2 1 1 2 3 2 1 1 ...
result:
ok 249999 numbers
Test #15:
score: 0
Accepted
time: 2744ms
memory: 59004kb
input:
250000 249999 14095 6 220950 6 234662 3 35913 1 132258 4 200544 10 135104 7 148916 1 13117 5 190176 9 222898 8 91946 4 178090 4 18354 1 151369 2 12233 6 228757 6 161742 7 33667 9 79810 1 74379 10 162789 3 196843 7 223296 9 78881 10 103789 5 84979 7 234254 5 80219 2 27415 7 65636 6 245431 4 16975 7 2...
output:
2 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 ...
result:
ok 249999 numbers
Test #16:
score: 0
Accepted
time: 2750ms
memory: 59008kb
input:
250000 249999 234423 1 106490 1 209289 1 86924 1 54501 1 166355 1 228761 1 165944 1 172158 1 64661 1 167348 1 196763 1 98465 1 56621 1 138329 1 149908 1 58448 1 231726 1 171821 1 203962 1 80624 1 299 1 16257 1 193382 1 226372 1 103199 1 160198 1 206884 1 43643 1 246448 1 197980 1 164317 1 228968 1 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 249999 numbers
Test #17:
score: 0
Accepted
time: 2540ms
memory: 56012kb
input:
100000 249999 93220 59 126118 58 114760 31 127602 91 78964 37 107468 28 17418 34 20051 6 25078 32 238158 11 143557 45 177110 45 101603 44 55221 8 27168 33 12698 44 96309 71 228393 7 85535 53 161888 73 97093 73 177327 72 151564 44 113400 33 80491 47 62362 93 15475 4 134593 67 204219 69 128232 67 1335...
output:
1 1 2 1 2 9 1 2 1 2 2 3 3 1 1 2 1 1 1 1 1 3 3 5 1 2 1 1 1 5 3 1 1 2 1 1 3 1 1 3 3 1 2 2 1 2 1 3 1 1 3 3 1 1 1 2 2 1 3 2 5 2 1 2 3 1 1 2 1 2 1 1 1 1 1 2 3 3 3 2 9 5 3 1 2 3 3 3 2 1 3 1 3 1 3 2 1 1 2 1 1 2 1 1 2 3 3 2 1 1 1 5 3 5 1 2 1 1 5 1 1 5 1 2 1 1 1 1 1 3 3 2 1 3 1 2 3 1 1 3 5 1 2 1 3 1 3 1 2 3 ...
result:
ok 249999 numbers
Test #18:
score: 0
Accepted
time: 2717ms
memory: 57036kb
input:
150000 249999 104484 72 183971 17 236903 47 85763 51 109721 7 115135 100 162866 62 13428 6 134736 85 108324 46 94466 1 175154 17 72231 54 166036 34 198137 84 146960 74 90976 26 210020 89 205699 80 7068 76 192964 51 93065 27 166315 35 80521 64 41842 13 83346 79 119551 5 96204 72 97493 66 92835 15 312...
output:
1 1 1 3 1 2 1 1 1 2 1 2 1 2 1 1 1 3 1 1 3 1 2 1 1 3 1 1 1 2 1 1 1 2 1 5 1 1 1 1 1 1 2 2 2 1 1 2 3 2 2 2 1 2 1 1 3 3 1 1 2 2 3 1 1 2 1 1 2 1 1 1 1 1 3 1 2 2 1 2 2 1 1 1 1 1 2 2 1 2 2 5 1 1 1 1 2 3 2 2 1 1 1 3 1 2 1 1 3 1 1 3 3 1 1 1 1 1 1 2 3 2 1 2 1 1 1 3 1 2 2 2 1 1 2 2 1 5 1 2 2 3 1 2 2 1 1 2 2 1 ...
result:
ok 249999 numbers
Test #19:
score: 0
Accepted
time: 2752ms
memory: 57928kb
input:
200000 249999 47102 39 120564 49 211340 98 112018 76 128324 79 13658 56 145481 5 212577 92 153372 83 195457 13 67116 53 183188 95 159717 50 223315 42 123415 47 143994 74 39260 51 58850 22 198700 27 22129 53 244348 12 112600 33 93161 52 165358 80 162648 46 238139 8 224484 6 236710 2 45342 99 44056 3 ...
output:
1 1 1 1 1 1 1 2 2 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 2 1 1 1 1 2 1 1 1 1 2 1 1 3 2 3 2 1 1 1 2 1 1 1 2 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 2 1 ...
result:
ok 249999 numbers
Test #20:
score: 0
Accepted
time: 2763ms
memory: 59080kb
input:
250000 249999 113549 52 245740 8 25655 22 218082 47 132245 45 218861 28 37315 30 111164 95 14826 36 107398 37 156792 14 48628 66 132434 72 28151 59 158589 94 7348 97 56728 5 190552 8 170423 55 65115 44 106177 86 202419 88 183685 47 200452 7 72434 8 161099 94 95797 19 92937 7 75848 100 238323 38 1721...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 249999 numbers
Test #21:
score: 0
Accepted
time: 2546ms
memory: 56048kb
input:
100000 249999 215178 78 137308 320 85918 996 37671 196 229886 523 231932 923 231942 388 174478 949 3670 606 187312 514 113705 684 239037 255 207483 436 54280 528 227569 162 29778 206 139135 341 39789 362 191291 41 102694 729 208895 941 57449 360 30418 630 123629 754 39958 20 220635 888 43818 148 531...
output:
2 3 2 3 3 1 5 1 1 1 1 1 1 2 5 3 3 3 1 1 1 1 2 2 5 3 2 5 5 2 5 2 3 2 1 2 3 2 3 1 2 2 3 1 1 2 1 2 1 1 1 1 3 1 1 5 3 1 3 2 1 2 1 2 1 1 5 3 1 5 1 3 1 2 3 1 1 1 3 1 3 1 1 2 5 1 1 2 3 1 1 2 1 1 1 9 1 1 3 9 3 1 2 1 3 3 5 1 3 2 1 2 1 2 1 3 5 1 2 2 1 1 5 2 2 3 1 1 2 1 1 1 1 1 1 1 1 3 3 2 3 2 1 1 5 1 3 1 2 1 ...
result:
ok 249999 numbers
Test #22:
score: 0
Accepted
time: 2698ms
memory: 57016kb
input:
150000 249999 168799 574 236614 391 5626 61 80977 154 38826 825 210532 62 100484 431 137419 781 103555 171 155556 287 247529 26 33559 487 177031 92 195197 875 91976 329 199343 636 83803 545 106072 247 123800 617 25942 788 235116 540 75666 678 240796 87 116602 682 229461 207 234450 428 235548 279 159...
output:
1 3 1 1 2 1 1 1 1 1 2 3 3 1 1 1 1 1 2 1 1 2 1 1 1 1 1 5 3 1 1 5 1 1 1 1 1 1 1 3 2 1 2 1 1 3 2 1 1 1 5 1 1 1 1 1 1 1 2 3 1 2 2 2 3 1 5 3 1 2 1 3 1 3 3 1 2 3 1 1 1 1 2 3 2 2 1 3 1 2 1 2 2 1 3 1 3 1 2 1 2 1 1 2 1 3 1 1 2 3 1 1 1 5 3 2 1 1 1 1 1 1 3 1 2 1 2 1 1 2 1 1 5 3 2 3 3 1 1 1 2 2 3 1 1 1 1 1 2 1 ...
result:
ok 249999 numbers
Test #23:
score: 0
Accepted
time: 2744ms
memory: 57952kb
input:
200000 249999 220479 940 50222 148 184880 27 222833 69 4952 631 43460 820 140864 16 15536 585 121758 416 81558 785 139693 320 164815 379 6191 763 223454 81 202200 271 68519 74 25162 498 51853 454 170830 650 123228 426 131945 392 191834 517 152172 502 117499 506 103682 415 245558 424 146040 951 87752...
output:
1 2 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 3 2 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 3 1 1 1 1 1 2 2 1 1 2 1 3 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 2 2 1 2 1 1 2 1 1 1 3 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 2 2 1 2 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 ...
result:
ok 249999 numbers
Test #24:
score: 0
Accepted
time: 2760ms
memory: 59128kb
input:
250000 249999 71099 140 102518 514 183279 196 9460 731 155766 741 159169 471 240491 548 72124 713 92079 572 102680 262 27525 958 1818 610 245646 611 85560 428 14629 438 195435 311 30920 702 105014 531 9136 11 134312 381 88919 991 56603 642 102308 551 68202 138 12583 498 88565 667 69470 82 213748 540...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 249999 numbers
Test #25:
score: 0
Accepted
time: 2545ms
memory: 55996kb
input:
100000 249999 143875 3079 35794 9717 78870 1826 154059 3784 185253 1989 50422 6248 142560 6933 142367 7270 199873 8171 232637 2149 766 6740 128174 8273 174253 2020 71559 974 33140 3168 247328 4196 235516 7852 118076 6395 165442 1875 15428 8418 143016 5686 122930 6 97686 6807 215402 719 152923 7495 1...
output:
2 5 1 3 1 5 2 1 3 1 2 1 2 2 2 2 9 2 5 9 5 3 3 1 1 3 5 2 2 1 3 1 3 3 1 5 1 2 1 5 9 2 2 3 2 1 1 3 1 5 2 3 2 2 2 2 5 5 1 1 1 5 1 1 1 2 2 1 3 5 2 1 1 5 1 2 3 1 5 5 1 5 5 1 2 1 1 1 5 3 1 1 5 3 1 2 9 1 5 5 3 2 3 1 1 2 5 5 1 3 1 1 2 5 1 2 1 3 1 2 1 3 1 1 2 1 2 5 3 3 3 2 2 1 1 2 2 5 9 5 3 5 3 3 3 2 5 2 3 1 ...
result:
ok 249999 numbers
Test #26:
score: 0
Accepted
time: 2714ms
memory: 57088kb
input:
150000 249999 208515 1037 226810 8037 78579 8990 196348 454 52075 3057 210394 7076 132508 6037 33903 3827 45161 3699 181439 3102 81472 8711 241071 8091 177966 9734 10995 5634 142541 4395 150681 2847 64108 3634 236691 6727 44362 3578 91381 3400 115765 7253 95492 6997 86886 4546 137861 3681 89217 9885...
output:
1 1 1 1 1 3 1 2 1 1 1 1 1 2 1 1 1 2 1 3 1 1 1 1 3 3 1 2 1 1 1 1 1 5 1 1 1 1 1 2 2 2 2 1 1 1 3 1 2 1 1 1 2 3 1 1 1 1 9 2 1 1 1 1 1 1 2 1 1 1 2 1 3 1 1 2 3 1 2 1 1 3 1 2 1 1 1 1 1 2 1 1 1 1 3 2 1 1 2 1 3 1 3 3 2 1 1 2 1 1 1 1 1 1 2 3 1 1 1 1 1 1 2 5 2 1 2 1 1 1 1 1 1 1 3 1 1 1 2 1 3 1 1 1 1 2 3 1 1 2 ...
result:
ok 249999 numbers
Test #27:
score: 0
Accepted
time: 2758ms
memory: 57988kb
input:
200000 249999 19515 6770 260 7289 46752 6511 235290 1326 69396 2617 218263 711 68770 3615 160983 5021 74125 2662 245771 8858 224783 7181 235656 4986 163114 3041 101632 1797 64682 4595 22763 4476 145956 9767 50440 3970 20831 9646 32979 365 147294 5959 5700 3518 167684 258 105791 2718 129850 8902 2168...
output:
1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 2 1 3 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 2 3 1 1 1 2 1 1 1 1 3 3 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 2 2 1 1 1 1 ...
result:
ok 249999 numbers
Test #28:
score: 0
Accepted
time: 2771ms
memory: 59128kb
input:
250000 249999 233586 2024 249814 5609 98965 9482 21269 7996 112196 3685 56401 4243 248656 5822 246725 8874 239803 3997 154988 7106 163971 9153 17019 4804 114980 9267 15470 7944 148695 5822 48302 5830 17357 1357 85078 1597 217000 5941 193654 6835 41788 6310 84917 509 111123 2589 219424 5680 217784 85...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 249999 numbers
Test #29:
score: 0
Accepted
time: 2540ms
memory: 56072kb
input:
100000 249999 218060 20345 27334 62482 125176 75231 164701 51166 191015 8172 197002 40902 212572 96076 79429 83748 8322 65763 117710 55688 163851 18354 61106 26868 169159 5528 85864 73608 229644 69531 69326 96862 136553 87015 41717 8087 3709 40727 233990 84886 99712 32178 217040 75596 149456 83736 1...
output:
1 3 1 1 2 3 1 3 2 1 1 2 2 3 5 2 2 2 2 2 3 5 2 2 2 2 5 3 3 3 9 2 1 2 3 1 1 1 2 3 3 1 3 1 3 3 3 1 3 1 5 1 1 2 2 3 3 2 3 2 1 3 1 3 2 1 1 3 2 1 1 2 9 2 2 3 3 3 2 3 3 3 1 1 1 3 2 2 1 1 1 2 3 1 2 5 2 1 2 3 5 3 1 1 1 1 3 2 2 2 3 1 1 3 1 9 2 3 2 3 9 1 5 9 1 5 1 1 2 1 1 1 2 2 1 3 1 2 2 1 1 3 3 2 1 2 1 2 3 2 ...
result:
ok 249999 numbers
Test #30:
score: 0
Accepted
time: 2727ms
memory: 56944kb
input:
150000 249999 234931 117721 165760 121374 39901 90389 65401 36642 127661 143888 111190 11903 248547 55018 25670 51452 29737 77284 34785 88158 41023 86741 210736 96409 45042 131729 156818 38710 102234 58616 229573 45925 240495 63260 27301 13493 239464 120694 57130 18370 65373 113177 200234 111599 813...
output:
1 2 1 1 2 1 1 3 1 2 5 1 1 2 3 1 1 1 1 2 3 3 3 3 1 2 2 3 1 3 2 1 1 3 1 2 2 5 1 3 3 1 1 3 1 2 3 1 1 3 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 5 1 1 1 1 1 1 2 2 3 2 1 1 3 1 1 1 1 2 1 1 3 3 1 1 2 1 1 1 5 1 1 1 3 1 2 1 2 1 1 1 1 1 1 1 3 1 1 2 1 1 1 1 1 3 1 1 1 1 2 1 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 3 1 2 1 1 1 ...
result:
ok 249999 numbers
Test #31:
score: 0
Accepted
time: 2766ms
memory: 57976kb
input:
200000 249999 115119 166519 203638 63359 136662 96182 198943 18205 186741 173012 170532 142299 132543 22820 152237 171263 248127 46558 134531 159448 113450 155775 26555 131466 9868 37421 45419 144841 199395 140829 110924 34275 83572 11001 48496 65156 133341 100284 141543 60021 170546 6240 231712 152...
output:
1 1 1 1 2 1 1 1 3 1 2 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 3 2 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 5 1 3 1 1 1 1 2 1 ...
result:
ok 249999 numbers
Test #32:
score: 0
Accepted
time: 2803ms
memory: 58996kb
input:
250000 249999 81716 70790 72006 29146 86672 228636 88825 53682 198298 58728 197705 130597 169560 249058 143240 6263 156637 225375 177754 174622 67575 6866 139636 192494 53704 155110 8984 209943 65297 79914 153405 142122 225695 169949 96758 194754 245965 121739 212635 243505 234106 28727 242548 11416...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 249999 numbers
Test #33:
score: 0
Accepted
time: 2733ms
memory: 58924kb
input:
250000 249999 250000 1 249999 1 249998 2 249997 2 249996 3 249995 3 249994 4 249993 4 249992 5 249991 5 249990 6 249989 6 249988 7 249987 7 249986 8 249985 8 249984 9 249983 9 249982 10 249981 10 249980 11 249979 11 249978 12 249977 12 249976 13 249975 13 249974 14 249973 14 249972 15 249971 15 2499...
output:
3 3 3 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #34:
score: 0
Accepted
time: 2731ms
memory: 58916kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 2 249996 2 249995 2 249994 3 249993 3 249992 3 249991 4 249990 4 249989 4 249988 5 249987 5 249986 5 249985 6 249984 6 249983 6 249982 7 249981 7 249980 7 249979 8 249978 8 249977 8 249976 9 249975 9 249974 9 249973 10 249972 10 249971 10 249970 11 249...
output:
3 3 3 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #35:
score: 0
Accepted
time: 2736ms
memory: 59084kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 2 249994 2 249993 2 249992 2 249991 2 249990 3 249989 3 249988 3 249987 3 249986 3 249985 4 249984 4 249983 4 249982 4 249981 4 249980 5 249979 5 249978 5 249977 5 249976 5 249975 6 249974 6 249973 6 249972 6 249971 6 249970 7 249969 ...
output:
5 5 5 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #36:
score: 0
Accepted
time: 2713ms
memory: 58928kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #37:
score: 0
Accepted
time: 2730ms
memory: 58848kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 ...
result:
ok 249999 numbers
Test #38:
score: 0
Accepted
time: 2706ms
memory: 59128kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 ...
result:
ok 249999 numbers
Test #39:
score: 0
Accepted
time: 2716ms
memory: 58924kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 ...
result:
ok 249999 numbers
Test #40:
score: 0
Accepted
time: 2729ms
memory: 59128kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001...
result:
ok 249999 numbers
Test #41:
score: 0
Accepted
time: 2510ms
memory: 56068kb
input:
100000 250000 100000 1 99999 1 99998 1 99997 1 99996 1 99995 1 99994 1 99993 1 99992 1 99991 1 99990 1 99989 1 99988 1 99987 1 99986 1 99985 1 99984 1 99983 1 99982 1 99981 1 99980 1 99979 1 99978 1 99977 1 99976 1 99975 1 99974 1 99973 1 99972 1 99971 1 99970 1 99969 1 99968 1 99967 1 99966 1 99965...
output:
16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 16385 ...
result:
ok 250000 numbers
Test #42:
score: 0
Accepted
time: 2708ms
memory: 58964kb
input:
250000 249999 250000 1 249999 1 249998 2 249997 2 249996 3 249995 3 249994 4 249993 4 249992 5 249991 5 249990 6 249989 6 249988 7 249987 7 249986 8 249985 8 249984 9 249983 9 249982 10 249981 10 249980 11 249979 11 249978 12 249977 12 249976 13 249975 13 249974 14 249973 14 249972 15 249971 15 2499...
output:
3 3 3 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #43:
score: 0
Accepted
time: 2738ms
memory: 59004kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 2 249996 2 249995 2 249994 3 249993 3 249992 3 249991 4 249990 4 249989 4 249988 5 249987 5 249986 5 249985 6 249984 6 249983 6 249982 7 249981 7 249980 7 249979 8 249978 8 249977 8 249976 9 249975 9 249974 9 249973 10 249972 10 249971 10 249970 11 249...
output:
3 3 3 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #44:
score: 0
Accepted
time: 2730ms
memory: 58920kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 2 249994 2 249993 2 249992 2 249991 2 249990 3 249989 3 249988 3 249987 3 249986 3 249985 4 249984 4 249983 4 249982 4 249981 4 249980 5 249979 5 249978 5 249977 5 249976 5 249975 6 249974 6 249973 6 249972 6 249971 6 249970 7 249969 ...
output:
5 5 5 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #45:
score: 0
Accepted
time: 2732ms
memory: 58972kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 249999 numbers
Test #46:
score: 0
Accepted
time: 2718ms
memory: 59148kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 257 ...
result:
ok 249999 numbers
Test #47:
score: 0
Accepted
time: 2714ms
memory: 59004kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 4097 ...
result:
ok 249999 numbers
Test #48:
score: 0
Accepted
time: 2715ms
memory: 58900kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 32769 ...
result:
ok 249999 numbers
Test #49:
score: 0
Accepted
time: 2727ms
memory: 58932kb
input:
250000 249999 250000 1 249999 1 249998 1 249997 1 249996 1 249995 1 249994 1 249993 1 249992 1 249991 1 249990 1 249989 1 249988 1 249987 1 249986 1 249985 1 249984 1 249983 1 249982 1 249981 1 249980 1 249979 1 249978 1 249977 1 249976 1 249975 1 249974 1 249973 1 249972 1 249971 1 249970 1 249969 ...
output:
125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001 125001...
result:
ok 249999 numbers
Test #50:
score: 0
Accepted
time: 2728ms
memory: 58948kb
input:
250000 250000 250000 1 249999 2 249998 2 249997 2 249996 2 249995 2 249994 2 249993 2 249992 2 249991 2 249990 2 249989 2 249988 2 249987 2 249986 2 249985 2 249984 2 249983 2 249982 2 249981 2 249980 2 249979 2 249978 2 249977 2 249976 2 249975 2 249974 2 249973 2 249972 2 249971 2 249970 2 249969 ...
output:
2 3 3 5 5 5 5 9 9 9 9 9 9 9 9 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 ...
result:
ok 250000 numbers
Extra Test:
score: 0
Extra Test Passed