QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#598148 | #4276. Balls and Holes | Richard1211 | AC ✓ | 22ms | 4264kb | C++23 | 52.4kb | 2024-09-28 20:39:21 | 2024-09-28 20:39:21 |
Judging History
answer
// ____ __ __ _ ___ _ _
// /\ _`\ __ /\ \ /\ \ /' \ /'___`\ /' \ /' \
// \ \ \L\ \/\_\ ___\ \ \___ __ _ __ \_\ \/\_, \ /\_\ /\ \ /\_, \/\_, \
// \ \ , /\/\ \ /'___\ \ _ `\ /'__`\ /\`'__\/'_` \/_/\ \\/_/// /__\/_/\ \/_/\ \
// \ \ \\ \\ \ \/\ \__/\ \ \ \ \/\ \L\.\_\ \ \//\ \L\ \ \ \ \ // /_\ \ \ \ \ \ \ \
// \ \_\ \_\ \_\ \____\\ \_\ \_\ \__/.\_\\ \_\\ \___,_\ \ \_\/\______/ \ \_\ \ \_\
// \/_/\/ /\/_/\/____/ \/_/\/_/\/__/\/_/ \/_/ \/__,_ / \/_/\/_____/ \/_/ \/_/
/**************************************************
* Fast Algorithm Template by Richard1211.
* Please submit with C++14 or higher version.
* Blog on Luogu: https://www.luogu.com.cn/blog/522539/
* Blog on Byethost: http://Richard1211.byethost5.com/
* Blog on RBTree's: https://Richard1211.rbtr.ee/
***************************************************/
//#pragma GCC optimize(3,"Ofast","inline")
//#pragma GCC target("avx2")
//open Ofast sometimes
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
//#include <bits/extc++.h>
#else
//#include <ext/rope>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/hash_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//#include <ext/pb_ds/priority_queue.hpp>
#endif
//#ifdef __linux__
//#include <sys/mman.h>
//#include <sys/types.h>
//#include <fcntl.h>
//#include <unistd.h>
//#else
//#endif
using namespace std;
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;
#define YES io.writeln("YES")
#define Yes io.writeln("Yes")
#define yes io.writeln("yes")
#define NO io.writeln("NO")
#define No io.writeln("No")
#define no io.writeln("no")
#define Poss io.writeln("Possible")
#define poss io.writeln("possible")
#define Impo io.writeln("Impossible")
#define impo io.writeln("impossible")
#define Alice io.writeln("Alice")
#define Bob io.writeln("Bob")
#define Taka io.writeln("Takahashi")
#define Aoki io.writeln("Aoki")
#define PFir io.writeln("First")
#define Pfir io.writeln("first")
#define PSec io.writeln("Second")
#define Psec io.writeln("second")
#define RYES return YES,0
#define RYes return Yes,0
#define Ryes return yes,0
#define RNO return NO,0
#define RNo return No,0
#define Rno return no,0
#define RPoss return Poss,0
#define Rposs return poss,0
#define RImpo return Impo,0
#define Rimpo return impo,0
#define RAlice return Alice,0
#define RTaka return Taka,0
#define RAoki return Aoki,0
#define RBob return Bob,0
#define RFir return PFir,0
#define Rfir return Pfir,0
#define RSec return PSec,0
#define Rsec return Psec,0
#define pf emplace_front
#define pb emplace_back
#define ep emplace
#define ppb pop_back
#define ppf pop_front
#define gp make_pair
#define gt make_tuple
#define fr first
#define sd second
#define elif else if
#define PCase(i) (io.write("Case #"),wrt(i),io.write(": "),0)
#define sc(x) static_cast<long long>(x)
#define scu(x) static_cast<unsigned>(x)
#define scU(x) static_cast<unsigned long long>(x)
#define scd(x) static_cast<double>(x)
#define scD(x) static_cast<long double>(x)
#define scr(x) static_cast<char>(x)
#define sci(x) static_cast<int>(x)
#define GMX(T) numeric_limits<T>::max()
#define GMN(T) numeric_limits<T>::min()
#define GIN(T) numeric_limits<T>::infinity()
#define GES(T) numeric_limits<T>::epsilon()
#define ALL1(G) G.begin(),G.end()
#define ALL2(G,x) G.begin()+x,G.end()
#define ALL3(G,x,y) G.begin()+x,G.begin()+y
#define RALL1(G) G.rbegin(),G.rend()
#define RALL2(G,x) G.rbegin()+x,G.rend()
#define RALL3(G,x,y) G.rbegin()+x,G.rbegin()+y
#define ALLA(G,x,y) G+x,G+y+1
#define SIZ(G) sc(G.size())
#define SOR(...) sort(ALL(__VA_ARGS__))
#define REV(...) reverse(ALL(__VA_ARGS__))
#define MIN(...) *min_element(ALL(__VA_ARGS__))
#define MAX(...) *max_element(ALL(__VA_ARGS__))
#define SUM(T,...) accumulate(ALL(__VA_ARGS__),static_cast<T>(0))
#define LB(x,...) lower_bound(ALL(__VA_ARGS__),x)
#define UB(x,...) upper_bound(ALL(__VA_ARGS__),x)
#define LBG(x,...) lower_bound(ALL(__VA_ARGS__),x,greater{})
#define UBG(x,...) upper_bound(ALL(__VA_ARGS__),x,greater{})
#define FL(x,...) fill(ALL(__VA_ARGS__),x)
#define IOT(x,...) iota(ALL(__VA_ARGS__),x)
#define SIZ(G) sc(G.size())
#define SORA(G,x,y) sort(ALLA(G,x,y))
#define REVA(G,x,y) reverse(ALLA(G,x,y))
#define MINA(G,x,y) *min_element(ALLA(G,x,y))
#define MAXA(G,x,y) *max_element(ALLA(G,x,y))
#define SUMA(T,G,x,y) accumulate(ALLA(G,x,y),static_cast<T>(0))
#define LBA(G,x,y,v) lower_bound(ALLA(G,x,y),v)
#define UBA(G,x,y,v) upper_bound(ALLA(G,x,y),v)
#define LBGA(G,x,y,v) lower_bound(ALLA(G,x,y),v,greater{})
#define UBGA(G,x,y,v) upper_bound(ALLA(G,x,y),v,greater{})
#define FLA(G,x,y,v) fill(ALLA(G,x,y),x)
#define IOTA(G,x,y,v) iota(ALLA(G,x,y),x)
#define MEMS(G,v) memset(G,v,sizeof(G))
#define MEMSV(G,v,s) memset(G,v,s)
#define UNQ(G,x) \
sort(ALL(G,x)); \
G.erase(unique(ALL(G,x)),G.end());
#define UNQA(G,x,y) \
sort(ALLA(G,x,y)); \
register long long LEN=unique(ALLA(G,x,y))-G-1;
#define For1(a) for(register int i=1,i##_r=(a);i<=i##_r;++i)
#define For2(i,a) for(register int i=1,i##_r=(a);i<=i##_r;++i)
#define For3(i,a,b) for(register int i=(a),i##_r=(b);i<=i##_r;++i)
#define For4(i,a,b,c) for(register int i=(a),i##_r=(b);i<=i##_r;i+=(c))
#define For1R(a) for(register int i=(a);i>=1;--i)
#define For2R(i,a) for(register int i=(a);i>=1;--i)
#define For3R(i,a,b) for(register int i=(a),i##_r=(b);i>=i##_r;--i)
#define For4R(i,a,b,c) for(register int i=(a),i##_r=(b);i>=i##_r;i-=(c))
#define For01(a) for(register int i=0,i##_r=(a);i<i##_r;++i)
#define For02(i,a) for(register int i=0,i##_r=(a);i<i##_r;++i)
#define For03(i,a,b) for(register int i=(a),i##_r=(b);i<i##_r;++i)
#define For04(i,a,b,c) for(register int i=(a),i##_r=(b);i<i##_r;i+=(c))
#define For01R(a) for(register int i=(a)-1;i>=0;--i)
#define For02R(i,a) for(register int i=(a)-1;i>=0;--i)
#define For03R(i,a,b) for(register int i=(a)-1,i##_r=(b);i>=i##_r;--i)
#define For04R(i,a,b,c) for(register int i=(a)-1,i##_r=(b);i>=i##_r;i-=(c))
#define ForN1(a) for(register int i=1;i<=(a);++i)
#define ForN2(i,a) for(register int i=1;i<=(a);++i)
#define ForN3(i,a,b) for(register int i=(a);i<=(b);++i)
#define ForN4(i,a,b,c) for(register int i=(a);i<=(b);i+=(c))
#define ForN1R(a) for(register int i=(a);i>=1;--i)
#define ForN2R(i,a) for(register int i=(a);i>=1;--i)
#define ForN3R(i,a,b) for(register int i=(a);i>=(b);--i)
#define ForN4R(i,a,b,c) for(register int i=(a);i>=(b);i-=(c))
#define ForN01(a) for(register int i=0;i<(a);++i)
#define ForN02(i,a) for(register int i=0;i<(a);++i)
#define ForN03(i,a,b) for(register int i=(a);i<(b);++i)
#define ForN04(i,a,b,c) for(register int i=(a);i<(b);i+=(c))
#define ForN01R(a) for(register int i=(a)-1;i>=0;--i)
#define ForN02R(i,a) for(register int i=(a)-1;i>=0;--i)
#define ForN03R(i,a,b) for(register int i=(a)-1;i>=(b);--i)
#define ForN04R(i,a,b,c) for(register int i=(a)-1;i>=(b);i-=(c))
#define For1E(i,a) for(auto &&i:a)
#define For2E(x,y,a) for(auto &&[x,y]:a)
#define For3E(x,y,z,a) for(auto &&[x,y,z]:a)
#define For4E(x,y,z,w,a) for(auto &&[x,y,z,w]:a)
#define For1EG(u) for(register int i=head[u],to=edge[i].to;i;i=edge[i].nxt,to=edge[i].to)
#define For2EG(i,u) for(register int i=head[u],to=edge[i].to;i;i=edge[i].nxt,to=edge[i].to)
#define For3EG(i,u,w) for(register int i=head[u],to=edge[i].to,w=edge[i].w;i;i=edge[i].nxt,to=edge[i].to,w=edge[i].w)
#define For4EG(i,u,w,c) for(register int i=head[u],to=edge[i].to,w=edge[i].w,c=edge[i].c;i;i=edge[i].nxt,to=edge[i].to,w=edge[i].w,c=edge[i].w)
#define For1EGW(u) for(register int i=head[u],to=edge[i].to;i!=-1;i=edge[i].nxt,to=edge[i].to)
#define For2EGW(i,u) for(register int i=head[u],to=edge[i].to;i!=-1;i=edge[i].nxt,to=edge[i].to)
#define For3EGW(i,u,x) for(register int i=head[u],to=edge[i].to;i!=x;i=edge[i].nxt,to=edge[i].to)
#define For4EGW(i,u,w,x) for(register int i=head[u],to=edge[i].to,w=edge[i].w;i!=x;i=edge[i].nxt,to=edge[i].to,w=edge[i].w)
#define OverLoad(a,b,c,d,e,...) e
#define Overload(a,b,c,d,...) d
#define For(...) OverLoad(__VA_ARGS__,For4,For3,For2,For1)(__VA_ARGS__)
#define ForR(...) OverLoad(__VA_ARGS__,For4R,For3R,For2R,For1R)(__VA_ARGS__)
#define For0(...) OverLoad(__VA_ARGS__,For04,For03,For02,For01)(__VA_ARGS__)
#define For0R(...) OverLoad(__VA_ARGS__,For04R,For03R,For02R,For01R)(__VA_ARGS__)
#define ForN(...) OverLoad(__VA_ARGS__,ForN4,ForN3,ForN2,ForN1)(__VA_ARGS__)
#define ForNR(...) OverLoad(__VA_ARGS__,ForN4R,ForN3R,ForN2R,ForN1R)(__VA_ARGS__)
#define ForN0(...) OverLoad(__VA_ARGS__,ForN04,ForN03,ForN02,ForN01)(__VA_ARGS__)
#define ForN0R(...) OverLoad(__VA_ARGS__,ForN04R,ForN03R,ForN02R,ForN01R)(__VA_ARGS__)
#define ForE(...) OverLoad(__VA_ARGS__,For3E,For2E,For1E)(__VA_ARGS__)
#define ForEG(...) OverLoad(__VA_ARGS__,For4EG,For3EG,For2EG,For1EG)(__VA_ARGS__)
#define ForEGW(...) OverLoad(__VA_ARGS__,For4EGW,For3EGW,For2EGW,For1EGW)(__VA_ARGS__)
#define ALL(...) Overload(__VA_ARGS__,ALL3,ALL2,ALL1)(__VA_ARGS__)
#define RALL(...) Overload(__VA_ARGS__,RALL3,RALL2,RALL1)(__VA_ARGS__)
#define ForPR(...) for(bool flag=true;flag?exchange(flag,false):next_permutation(ALL(__VA_ARGS__));)
#define ForPRA(G,x,y) for(bool flag=true;flag?exchange(flag,false):next_permutation(G+x,G+y+1);)
#define ForSubset(msk,s) \
for(register int msk=(s);msk;msk&=msk-1)
#define Inline __inline__ __attribute__ ((always_inline))
#define Test() \
register int TestCount=MultiCase?read():1; \
for(register int TestCase=1;TestCase<=TestCount;++TestCase)
#define Tesf() for(register int TestCase=1;TestCase<=t;++TestCase)
#define RD(...) register long long __VA_ARGS__;io.read(__VA_ARGS__)
#define RS(...) string __VA_ARGS__;io.read(__VA_ARGS__)
#define RC(...) register char __VA_ARGS__;io.read(__VA_ARGS__)
#define RI(...) register int __VA_ARGS__;io.read(__VA_ARGS__)
#define RU32(...) register unsigned __VA_ARGS__;io.read(__VA_ARGS__)
#define RU64(...) register unsigned long long __VA_ARGS__;io.read(__VA_ARGS__)
#define RF32(...) register double __VA_ARGS__;io.read(__VA_ARGS__)
#define RF64(...) register long double __VA_ARGS__;io.read(__VA_ARGS__)
#define RSP(T,...) register T __VA_ARGS__;readsp(__VA_ARGS__)
#define RV(G,n) \
vector<long long>G(n+1); \
For(n){ \
G[i]=read(); \
}
#define RVV(G,n,m) \
vector<vector<long long>>G(n+1,vector<long long>(m+1)); \
For(n){ \
For(j,m){ \
G[i][j]=read(); \
} \
}
#ifdef ONLINE_JUDGE
//when on OJ,close the debug version
//hope code with no bugs.
//think twice,code once.
//timer won't print anything
//don't be TLE or MLE,only AC.
#undef Debug
#undef Setmemory
#define Debug(...) 42
#define Setmemory(tmp) 0
#if __cplusplus>201402L
#define register
#else
//becaus of using c++17 and higher version, register are not allowed to use.
#endif
#else
//open debug version.
//hope code with no bugs.
//because of using c++17, we need to undefine register.
//Debug will print out the things we need.
//Setmemory will set the end memory we need.
#define register
#define Debug(...) cerr << "Debug " << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define Setmemory(Tmp) (Timebot::timer.End=&Tmp,0)
template<typename A,typename B>string to_string(pair<A,B>p);
template<typename A,typename B,typename C>string to_string(tuple<A,B,C>p);
template<typename A,typename B,typename C,typename D>string to_string(tuple<A,B,C,D>p);
string to_string(const string&s){return'"'+s+'"';}
string to_string(const char*s){return to_string((string)s);}
string to_string(bool b){return(b?"true":"false");}
string to_string(vector<bool>v){bool first=true;string res="{";for(int i=0;i<static_cast<int>(v.size());i++){if(!first){res+=", ";}first=false;res+=to_string(v[i]);}res+="}";return res;}
template<size_t N>string to_string(bitset<N>v){string res="";for(size_t i=0;i<N;i++){res+=static_cast<char>('0'+v[i]);}return res;}
template<typename A>string to_string(A v){bool first=true;string res="{";for(const auto&x:v){if(!first){res+=", ";}first=false;res+=to_string(x);}res+="}";return res;}
template<typename A,typename B>string to_string(pair<A,B>p){return"("+to_string(p.first)+", "+to_string(p.second)+")";}
template<typename A,typename B,typename C>string to_string(tuple<A,B,C>p){return"("+to_string(get<0>(p))+", "+to_string(get<1>(p))+", "+to_string(get<2>(p))+")";}
template<typename A,typename B,typename C,typename D>string to_string(tuple<A,B,C,D>p){return"("+to_string(get<0>(p))+", "+to_string(get<1>(p))+", "+to_string(get<2>(p))+", "+to_string(get<3>(p))+")";}
inline void debug_out(){cerr<<endl;}
template<typename Head,typename...Tail>void debug_out(Head H,Tail...T){cerr<<" "<<to_string(H);debug_out(T...);}
namespace Timebot{
//timer will print the time and the memory of the code for you.
//don't be TLE or MLE,only AC.
struct Timer{
bool f,*Beg,*End;clock_t Begin;Timer():Begin(clock()),Beg(&f){}~Timer(){double t=(clock()-Begin)*1000./CLOCKS_PER_SEC;t>=60000?fprintf(stderr,"Time: %.2lf min\n",t/60000.):t>=1000?fprintf(stderr,"Time: %.2lf s\n",t/1000.):fprintf(stderr,"Time: %.0lf ms\n",t);fprintf(stderr,"Memory: %.3lf MB\n",(End-Beg)/1048576.0);}
}timer;
}
#endif
[[maybe_unused]]constexpr double pi=3.1415926535897932384626433832795,ei=2.7182818284590452353602874713527;
[[maybe_unused]]constexpr long long ZR=0,OE=1;//ignore error
[[maybe_unused]]constexpr long long NJ=10,NP3=14,NP2=20;//O(n!),O(3^n),O(2^n)
[[maybe_unused]]constexpr long long N31=110,N32=150,N33=210;//O(n^3)
[[maybe_unused]]constexpr long long N21=1010,N22=3030,N23=5050;//O(n^2)
[[maybe_unused]]constexpr long long N11=100100,N12=300300,N13=500500,N14=700700;//O(n)
[[maybe_unused]]constexpr long long NB1=1000100,NB2=3000300,NB3=5000500,NB4=7000700,NB5=10001000;//O(n)
[[maybe_unused]]constexpr long long USEMOD[]={0,20091119,11190119,121911211,998244353,19260817,1000000007,1145141};
[[maybe_unused]]constexpr __int128 PW10[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000,100000000000000,1000000000000000,10000000000000000,100000000000000000,1000000000000000000,__int128(1000000000000000000)*10,__int128(1000000000000000000)*100,__int128(1000000000000000000)*1000,__int128(1000000000000000000)*10000,__int128(1000000000000000000)*100000,__int128(1000000000000000000)*1000000,__int128(1000000000000000000)*10000000,
__int128(1000000000000000000)*100000000,__int128(1000000000000000000)*1000000000,__int128(1000000000000000000)*10000000000,__int128(1000000000000000000)*100000000000,__int128(1000000000000000000)*1000000000000,__int128(1000000000000000000)*1000000000000,__int128(1000000000000000000)*100000000000000,__int128(1000000000000000000)*1000000000000000,__int128(1000000000000000000)*10000000000000000,__int128(1000000000000000000)*100000000000000000,__int128(1000000000000000000)*1000000000000000000};
template<class T>constexpr T Infty=0;
template<>constexpr int Infty<int> =1000000000;
template<>constexpr long long Infty<long long> =2000000000000000000;
template<>constexpr unsigned Infty<unsigned> =1000000000;
template<>constexpr unsigned long long Infty<unsigned long long> =2000000000000000000;
template<>constexpr __int128 Infty<__int128> =__int128(Infty<long long>)*Infty<long long>;
template<>constexpr long double Infty<long double> =2e18;
template<>constexpr __float128 Infty<__float128> =2e18;
template<>constexpr double Infty<double> =2e18;
template<class T>Inline T Min(register T a,register T b){return a<b?a:b;}
template<class T>Inline T Max(register T a,register T b){return a>b?a:b;}
template<class T>inline T Min(initializer_list<T>a){register T x=numeric_limits<T>::max();for(auto &&it:a){x=Min(x,it);}return x;}
template<class T>inline T Max(initializer_list<T>a){register T x=numeric_limits<T>::min();for(auto &&it:a){x=Max(x,it);}return x;}
template<class T,class Q>Inline bool Cmin(register T&a,register Q b){return a>b?(a=b,true):false;}
template<class T,class Q>Inline bool Cmax(register T&a,register Q b){return a<b?(a=b,true):false;}
template<class T,class Q>inline bool Cmin(register T&a,initializer_list<Q>b){register T x=a;for(auto &&it:b){Cmin(a,it);}return x==a?false:true;}
template<class T,class Q>inline bool Cmax(register T&a,initializer_list<Q>b){register T x=a;for(auto &&it:b){Cmax(a,it);}return x==a?false:true;}
template<class T>Inline T Abs(register T a){return a>0?a:-a;}
template<class T>inline T Floor(register T a,register T b){return a/b-(a%b&&(a^b)<0);}
template<class T>inline T Ceil(register T a,register T b){return Floor(a+b-1,b);}
template<class T>inline T Bmod(register T a,register T b){return a-b*Floor(a,b);}
template<class T>inline pair<T,T>Divmod(register T a,register T b){register T q=Floor(a,b);return gp(q,a-q*b);}
template<class T>Inline T Lowbit(register T x){return (x&-x);}
template<class T>Inline T Topbit(register T x){return 63-__builtin_clzll(x);}
template<class T>Inline void Swap(register T&a,register T&b){return a!=b?b^=a^=b^=a,void():void();}
template<class T>inline T Gcd(T a,T b){return b?Gcd(b,a%b):a;}
template<class T>inline T Lcm(T a,T b){return a*b/Gcd(a,b);}
template<class T>inline T Exgcd(T a,T b,T&x,T&y){if(b==0){x=1;y=0;return a;}T d=Exgcd(b,a%b,x,y);T t=x;x=y;y=t-a/b*y;return d;}
template<class T>inline T ExExgcd(T a,T b,T&x,T&y,T c){if(b==0){x=c;y=0;return a;}T d=ExExgcd(b,a%b,x,y,c);T t=x;x=y;y=t-a/b*y;return d;}
template<class T>inline T Ksc(T a,T b){if(a==0||b==0){return 0;}T ans=0;while(b){if(b&1){ans=a+ans;}a=a+a;b>>=1;}return ans;}
template<class T>inline T Ksc(T a,T b,T p){if(a==0||b==0){return 0;}T ans=0;while(b){if(b&1){ans=(a+ans)%p;}a=(a+a)%p;b>>=1;}return ans;}
template<class T>inline T Ksm(T a,T b,bool f=false){if(a==0&&b==0)return 1;if(a==0){return 0;}if(b==0){return 1;}T ans=1;while(b){if(b&1){ans=!f?a*ans:Ksc(a,ans);}a=!f?a*a:Ksc(a,a);b>>=1;}return ans;}
template<class T>inline T Ksm(T a,T b,T p,bool f=false){if(a==0&&b==0)return 1;if(a==0){return 0;}if(b==0){return 1%p;}T ans=1;while(b){if(b&1){ans=!f?a*ans%p:Ksc(a,ans,p);}a=!f?a*a%p:Ksc(a,a,p);b>>=1;}return ans;}
template<class T>inline T Inv(T x,T p){return Ksm(x,p-2,p);}
template<class T>inline T Fac(T n){if(n==0){return 1;}int ans=1;for(register int i=1;i<=n;++i){ans*=i;}return ans;}
template<class T>inline T Fac(T n,T p){if(n==0){return 1;}register long long ans=1;for(register int i=1;i<=n;++i){ans=ans*i%p;}return ans;}
template<class T>inline vector<pair<T,T>>Factor(T x){vector<pair<T,T>>ans;for(register T i=2;i*i<=x;++i)if(x%i==0){ans.emplace_back(i,1);while((x/=i)%i==0)++ans.back().second;}x!=1?ans.emplace_back(x,1),0:0;return ans;}
template<class T>vector<T>Divisor(T x){vector<T>ans;for(register T i=1;i*i<=x;++i)if(x%i==0)ans.emplace_back(i),i*i!=x?ans.emplace_back(x/i),0:0;return ans;}
template<class T>Inline int Popcount(T x,bool f=true){return f?__builtin_popcountll(x):__builtin_popcount(x);}
template<class T>Inline int Prebit(T x,bool f=true){return f?__builtin_clzll(x):__builtin_clz(x);}
template<class T>Inline int Sufbit(T x,bool f=true){return f?__builtin_ctzll(x):__builtin_ctz(x);}
template<class T>Inline int Lowone(T x,bool f=true){return f?__builtin_ffsll(x):__builtin_ffs(x);}
template<class T>Inline int Parity(T x,bool f=true){return f?__builtin_parityll(x):__builtin_parity(x);}
template<class T>Inline bool Isdigit(T ch){return ch>='0'&&ch<='9';}
template<class T>Inline bool Isletter(T ch){return ch>='A'&&ch<='Z'||ch>='a'&&ch<='z';}
template<class T>Inline bool Isupper(T ch){return ch>='A'&&ch<='Z';}
template<class T>Inline bool Islower(T ch){return ch>='a'&&ch<='z';}
template<class T>Inline char Tolower(T ch){return ch-'A'+'a';}
template<class T>Inline char Toupper(T ch){return ch-'a'+'A';}
template<class T>inline void Memset(T*d,long long n,long long s){for(register int i=0;i<=s-1;++i){d[i]=n;}}
template<class T>inline void Bug(T x,string name){cerr<<name<<": "<<x<<endl;}
template<class T>inline void Bug(T x){cerr<<x<<endl;}
template<class T>inline T Sin(register T degree){return sinl(degree*(pi/180));}
template<class T>inline T Cos(register T degree){return cosl(degree*(pi/180));}
template<class T>inline T Tan(register T degree){return tanl(degree*(pi/180));}
template<class T>inline T Asin(register T degree){return asinl(degree)*180.0/pi;}
template<class T>inline T Acos(register T degree){return acosl(degree)*180.0/pi;}
template<class T>inline T Atan(register T degree){return atanl(degree)*180.0/pi;}
template<class T>inline T Gpop(stack<T>&q){register T u=q.top();q.pop();return u;}
template<class T>inline T Gpop(queue<T>&q){register T u=q.front();q.pop();return u;}
template<class T>inline T Gpop(deque<T>&q){register T u=q.front();q.pop_front();return u;}
template<class T>inline T Gpop(priority_queue<T>&q){register T u=q.top();q.pop();return u;}
template<class T>inline T Gpop(priority_queue<T,vector<T>,greater<T>>&q){register T u=q.top();q.pop();return u;}
template<class T>inline T Gpop(vector<T>&G){register T u=G.back();G.pop_back();return u;}
template<class T>inline vector<T>Presum(vector<T>&a,int ind=1){vector<T>sum(SIZ(a)+0);For (i,ind,SIZ(a)-1){sum[i]=sum[i-1]+a[i];}return sum;}
template<class T>inline vector<T>Sufsum(vector<T>&a,int ind=1){vector<T>sum(SIZ(a)+1);ForR(i,SIZ(a)-1,ind){sum[i]=sum[i+1]+a[i];}return sum;}
template<class T>inline vector<T>Rearrange(vector<T>&a,vector<T>&ind,int id=1){vector<T>p(SIZ(ind)+id);For(i,ind,SIZ(ind)-(id^1)){p[i]=a[ind[i]];}return p;}
template<class T>inline vector<long long>Argsort(vector<T>&a,int id=1){vector<long long>ind(SIZ(a));iota(ALL(ind,id),0);sort(ALL(ind,id),[&](int i,int j){return a[i]==a[j]?i<j:a[i]<a[j];});return ind;}
template<class T>inline vector<long long>TransSV(T &s,char ch,char sp='?',int ind=1){vector<long long>G(SIZ(s)+ind);For(i,ind,SIZ(s)-1){G[i]=s[i]==sp?-1:s[i]-ch;}return G;}
template<class T>inline long long Rand(T l,T r){static mt19937_64 Rd(chrono::steady_clock::now().time_since_epoch().count());return uniform_int_distribution<long long>(l,r)(Rd);}
template<class T,class F>inline T Binarysearch(T l,T r,T f,const F &check,bool D=true){T mid,ans;for(mid=(l+r)>>1,ans=f;l<=r;mid=(l+r)>>1){check(mid)?ans=mid,(D?r=mid-1:l=mid+1):(D?l=mid+1:r=mid-1);}return ans;}
template<class T,class F>inline T Binarysearch(T l,T r,T f,double eps,const F &check,bool D=true){T mid,ans;for(mid=(l+r)/2;r-l>eps;mid=(l+r)/2){check(mid)?ans=mid,(D?l=mid:r=mid):(D?r=mid:l=mid);}return ans;}
template<class T>inline void Radixsort(register const int n,T*a,T*b){int r1[0x100],r2[0x100],r3[0x100],r4[0x100];memset(r1,0,sizeof(r1));memset(r2,0,sizeof(r2));memset(r3,0,sizeof(r3));memset(r4,0,sizeof(r4));register int i,tmp_int;register T*j,*tar;for(j=a+1,tar=a+n+1;j!=tar;++j){tmp_int=*(int*)j;++r1[tmp_int&0xff];++r2[(tmp_int>>8)&0xff];++r3[(tmp_int>>16)&0xff];++r4[tmp_int>>24];}for(i=1;i<=0xff;++i){r1[i]+=r1[i-1];r2[i]+=r2[i-1];r3[i]+=r3[i-1];r4[i]+=r4[i-1];}for(j=a+n;j!=a;--j){tmp_int=*(int*)j;b[r1[tmp_int&0xff]--]=*j;}for(j=b+n;j!=b;--j){tmp_int=*(int*)j;a[r2[(tmp_int>>8)&0xff]--]=*j;}for(j=a+n;j!=a;--j){tmp_int=*(int*)j;b[r3[(tmp_int>>16)&0xff]--]=*j;}for(j=b+n;j!=b;--j){tmp_int=*(int*)j;a[r4[tmp_int>>24]--]=*j;}}
template<class T>inline void Radixsort(register const int n,T*a,T*b,bool op){size_t size_of_type=sizeof(T);size_t num_of_buc=size_of_type>>1;unsigned**r=new unsigned*[num_of_buc];register int i,k;for(i=0;i<num_of_buc;++i){r[i]=new unsigned[0x10000];memset(r[i],0,0x10000*sizeof(unsigned));}register unsigned short tmp_us;register T*j,*tar;for(k=0;k<num_of_buc;++k){for(j=a+1,tar=a+n+1;j!=tar;++j){tmp_us=*(((unsigned short*)j)+k);++r[k][tmp_us];}}for(k=0;k<num_of_buc;++k){for(i=1;i<=0xffff;++i){r[k][i]+=r[k][i-1];}}for(k=0;k<num_of_buc;k+=0x2){i=k;for(j=a+n;j!=a;--j){tmp_us=*(((unsigned short*)j)+i);b[r[i][tmp_us]--]=*j;}i|=1;if(i==num_of_buc){break;}for(j=b+n;j!=b;--j){tmp_us=*(((unsigned short*)j)+i);a[r[i][tmp_us]--]=*j;}}for(int i=0;i<num_of_buc;i++){delete[]r[i];}delete[]r;}
template<class T>inline void Radixsort(register const int n,T*a,T*b,bool op1,bool op2){Radixsort(n,a,b,true);reverse(a+1,a+n+1);reverse(upper_bound(a+1,a+n+1,(T)(-0.0)),a+n+1);}
template<int R,int L=0,int M=(L+R>>1),class T>Inline void Unroll(int i,T f){R-L==1?f(L+i):(Unroll<M,L>(i,f),Unroll<R,M>(i,f));}
inline void OF(string s){string IN=s+".in";string OUT=s+".out";freopen(IN.c_str(),"r",stdin);freopen(OUT.c_str(),"w",stdout);}
inline void CF(string s){fclose(stdin);fclose(stdout);}
struct Safe_Hash{
static unsigned long long splitmix64(unsigned long long x){x+=0x9e3779b97f4a7c15;x=(x^(x>>30))*0xbf58476d1ce4e5b9;x=(x^(x>>27))*0x94d049bb133111eb;return x^(x>>31);}
size_t operator()(unsigned long long x)const{static const unsigned long long FIXED_RANDOM=chrono::steady_clock::now().time_since_epoch().count();return splitmix64(x+FIXED_RANDOM);}
};
#define UseBuffer
struct IO{
#ifdef UseBuffer
//unlockeds somtimes are a little faster than normals
//#define fread fread_unlocked
//#define fwrite fwrite_unlocked
const static int BUFSIZE=1<<20;
char buf[BUFSIZE],obuf[BUFSIZE],*p1,*p2,*pp;
inline char getchar(){return(p1==p2&&(p2=(p1=buf)+fread(buf,1,BUFSIZE,stdin),p1==p2)?EOF:*p1++);}
inline void putchar(char x){((pp-obuf==BUFSIZE&&(fwrite(obuf,1,BUFSIZE,stdout),pp=obuf)),*pp=x,pp++);}
inline IO&flush(){fwrite(obuf,1,pp-obuf,stdout);fflush(stdout);return*this;}
IO(){p1=buf,p2=buf,pp=obuf;}
~IO(){flush();}
#else
//remember to flush in interactive problems
//int(*getchar)()=&::getchar_unlocked;
//int(*putchar)(int)=&::putchar_unlocked;
int(*getchar)()=&::getchar;
int(*putchar)(int)=&::putchar;
inline IO&flush(){fflush(stdout);return*this;};
#endif
int k=2;
string sep=" ";
template<typename Tp,typename enable_if<is_integral<Tp>::value||is_same<Tp,__int128_t>::value>::type* =nullptr>inline int read(Tp&s){int f=1;char ch=getchar();s=0;while(!isdigit(ch)&&ch!=EOF)f=(ch=='-'?-1:1),ch=getchar();while(isdigit(ch))s=s*10+(ch^48),ch=getchar();s*=f;return ch!=EOF;}
template<typename Tp,typename enable_if<is_floating_point<Tp>::value>::type* =nullptr>inline int read(Tp&s){int f=1;char ch=getchar();s=0;while(!isdigit(ch)&&ch!=EOF&&ch!='.')f=(ch=='-'?-1:1),ch=getchar();while(isdigit(ch))s=s*10+(ch^48),ch=getchar();if(ch==EOF)return false;if(ch=='.'){Tp eps=0.1;ch=getchar();while(isdigit(ch))s=s+(ch^48)*eps,ch=getchar(),eps/=10;}s*=f;return ch!=EOF;}
inline int read(char&c){char ch=getchar();c=EOF;while(isspace(ch)&&ch!=EOF)ch=getchar();if(ch!=EOF)c=ch;return c!=EOF;}
inline int read(char*c){char ch=getchar(),*s=c;while(isspace(ch)&&ch!=EOF)ch=getchar();while(!isspace(ch)&&ch!=EOF)*(c++)=ch,ch=getchar();*c='\0';return s!=c;}
inline int read(string&s){s.clear();char ch=getchar();while(isspace(ch)&&ch!=EOF)ch=getchar();while(!isspace(ch)&&ch!=EOF)s+=ch,ch=getchar();return s.size()>0;}
inline int getline(char*c,const char&ed='\n'){char ch=getchar(),*s=c;while(ch!=ed&&ch!=EOF)*(c++)=ch,ch=getchar();*c='\0';return s!=c;}
inline int getline(string&s,const char&ed='\n'){s.clear();char ch=getchar();while(ch!=ed&&ch!=EOF)s+=ch,ch=getchar();return s.size()>0;}
template<typename Tp=int>inline Tp read(){Tp x;read(x);return x;}
template<typename Tp,typename...Ts>int read(Tp&x,Ts&...val){return read(x)&&read(val...);}
template<typename Tp,typename enable_if<is_integral<Tp>::value>::type* =nullptr>IO&write(Tp x){if(x<0)putchar('-'),x=-x;static char sta[114];int top=0;do sta[top++]=x%10+'0',x/=10;while(x);while(top)putchar(sta[--top]);return*this;}
inline IO&write(const string&str){for(char ch:str)putchar(ch);return*this;}
inline IO&write(const char*str){while(*str!='\0')putchar(*(str++));return*this;}
inline IO&write(char*str){return write((const char*)str);}
inline IO&write(const char&ch){return putchar(ch),*this;}
template<typename Tp,typename enable_if<is_floating_point<Tp>::value>::type* =nullptr>inline IO&write(Tp x){if(x>1e18||x<-1e18){write("[Floating point overflow]");throw;}if(x<0)putchar('-'),x=-x;const static long long pow10[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000,100000000000000,1000000000000000,10000000000000000,100000000000000000,100000000000000000,100000000000000000};const auto&n=pow10[k];long long whole=(int)x;double tmp=(x-whole)*n;long long frac=tmp;double diff=tmp-frac;if(diff>0.5){++frac;if(frac>=n)frac=0,++whole;}else if(diff==0.5&&((frac==0U)||(frac&1U)))++frac;write(whole);if(k==0U){diff=x-(double)whole;if((!(diff<0.5)||(diff>0.5))&&(whole&1))++whole;}else{putchar('.');static char sta[20];int count=k,top=0;while(frac){sta[top++]=frac%10+'0';frac/=10,count--;}while(count--)putchar('0');while(top)putchar(sta[--top]);}return*this;}
template<typename Tp,typename...Ts>inline IO&write(Tp x,Ts...val){write(x);write(sep);write(val...);return*this;}
template<typename...Ts>inline IO&writeln(Ts...val){write(val...);putchar('\n');return*this;}
inline IO&writeln(void){putchar('\n');return*this;}
template<typename Tp>inline IO&writeWith(Tp x,const string&s=" "){write(x),write(s);return*this;}
inline IO&setsep(const string&s){return sep=s,*this;}
inline IO&setprec(const int&K){return k=K,*this;}
}io;
inline int rd(){return io.read<int>();}
inline long long read(){return io.read<long long>();}
inline unsigned long long Read(){return io.read<unsigned long long>();}
template<class T,size_t x>inline void readsp(array<T,x>&G){For0(x)io.read(G[i]);return void();}
template<class T,class Q>inline void readsp(pair<T,Q>&x){io.read(x.first,x.second);return void();}
template<size_t N=0,class T>inline void readtp(T &t){if constexpr(N<tuple_size<T>::value){auto &x=get<N>(t);io.read(x);readtp<N+1>(t);}return void();}
template<class...T>inline void readsp(tuple<T...>&x){readtp(x);return void();}
template<class T,class...Args>inline void readsp(T&x,Args&...args){readsp(x);readsp(args...);return void();}
template<class T>inline bool wrt(T x){return io.write(x),true;}
template<class T>inline bool Write(T x,string ch="\n"){return io.writeWith(x,ch),true;}
template<class...T>inline bool write(T...x){io.write(x...);io.putchar('\n');return true;}
template<class T,size_t x>inline bool writesp(const array<T,x>&G){For0(x)Write(G[i],i==x-1?"\n":" ");return true;}
template<class T,class Q>inline bool writesp(const pair<T,Q>&x){Write(x.first," ");write(x.second);return true;}
template<size_t N=0,class T>inline bool writetp(const T t){if constexpr(N<tuple_size<T>::value){if constexpr(N>0){io.putchar(' ');}const auto x=get<N>(t);wrt(x);writetp<N+1>(t);}return true;}
template<class...T>inline bool writesp(tuple<T...>t){writetp(t);io.putchar('\n');return true;}
template<class T>inline bool writesp(vector<T>&G){if(G.empty())return false;register int sz=SIZ(G)-1;For(sz){Write(G[i],i==sz?"\n":" ");}return true;}
template<class T,class...Args>inline bool writesp(T x,Args&...args){writesp(x);writesp(args...);return true;}
inline bool WRITE(__int128 x,char ch='\n'){if(x<0)io.putchar('-'),x=-x;static char sta[114];int top=0;do sta[top++]=x%10+'0',x/=10;while(x);while(top)io.putchar(sta[--top]);io.putchar(ch);return true;}
//#endif
#if __cplusplus>=201402L
namespace Montgomery{
#define Modulus_Const
#define Modulus_Prime
//if modulus is const,open Montgomery Fast Version.
//if modulus is not const,open Dynamic Fast Version,if modulus is not prime,open Dynamic Modulus Version.
#ifdef Modulus_Prime
bool PR=true;
#else
bool PR=false;
#endif
namespace Mont32{
inline constexpr unsigned getroot1(int MOD){unsigned iv=MOD;for(register unsigned i=0;i!=4;++i){iv*=2U-MOD*iv;}return-iv;}
template<int MOD>struct Mont{
private:
unsigned v;static constexpr unsigned r1=getroot1(MOD),r2=-(unsigned long long)(MOD)%MOD;static_assert((MOD&1)==1);static_assert(-r1*MOD==1);static_assert(MOD<(1<<30));
inline static constexpr unsigned ksmmod(unsigned x,unsigned long long y){unsigned ans=1;for(;y!=0;y>>=1,x=(unsigned long long)(x)*x%MOD){if(y&1){ans=(unsigned long long)(ans)*x%MOD;}}return ans;}
inline static constexpr unsigned reduce(unsigned long long x){return x+(unsigned long long)(unsigned(x)*r1)*MOD>>32;}
inline static constexpr unsigned norm(unsigned x){return x-(MOD&-(x>=MOD));}
public:
static constexpr unsigned primitive(){unsigned tmp[32]={},cnt=0;constexpr unsigned long long phi=MOD-1;unsigned long long m=phi;for(register unsigned long long i=2;i*i<=m;++i){if(m%i==0){tmp[cnt++]=i;while(m%i==0){m/=i;}}}if(m!=1){tmp[cnt++]=m;}for(register unsigned long long ans=2;ans!=MOD;++ans){bool flag=true;for(register unsigned i=0;i!=cnt&&flag;++i){flag&=ksmmod(ans,phi/tmp[i])!=1;}if(flag){return ans;}}return 0;}
Mont()=default;
~Mont()=default;
constexpr Mont(unsigned v):v(reduce((unsigned long long)(v)*r2)){}
constexpr Mont(const Mont&x):v(x.v){}
inline int getP()const{return MOD;}
constexpr unsigned get()const{return norm(reduce(v));}
explicit constexpr operator unsigned()const{return get();}
explicit constexpr operator int()const{return(int)(get());}
Mont operator-()const{Mont ans;return ans.v=(MOD<<1&-(v!=0))-v,ans;}
Mont Inv()const{int x1=1,x3=0,a=get(),b=MOD;while(b!=0){int q=a/b;tie(x1,x3)=make_tuple(x3,x1-x3*q);tie(a,b)=make_tuple(b,a-b*q);}return Mont(x1+MOD);}
Mont&operator+=(const Mont&x){return v+=x.v-(MOD<<1),v+=MOD<<1&-(v>>31),*this;}
Mont&operator-=(const Mont&x){return v-=x.v,v+=MOD<<1&-(v>>31),*this;}
Mont&operator*=(const Mont&x){return v=reduce((unsigned long long)(v)*x.v),*this;}
Mont&operator/=(const Mont&x){return this->operator*=(x.Inv());}
#define stO(op) friend Mont operator op(const Mont&x,const Mont&y){return Mont(x)op##=y;}
stO(+)stO(-)stO(*)stO(/)
#undef stO
#define stO(op) friend bool operator op(const Mont&x,const Mont&y){return norm(x.v)op norm(y.v);}
stO(==)stO(!=)stO(>)stO(<)stO(>=)stO(<=)
#undef stO
Mont&operator++(){*this+=1;return*this;}
Mont&operator--(){*this-=1;return*this;}
Mont operator++(int){Mont ans(*this);*this+=1;return ans;}
Mont operator--(int){Mont ans(*this);*this-=1;return ans;}
Mont Ksm(long long b){Mont ans=1,a=get();while(b){if(b&1){ans=ans*a;}a=a*a;b>>=1;}return ans;}
friend istream&operator>>(istream&is,Mont&x){return is>>x.v,x.v=reduce((unsigned long long)(x.v)*r2),is;}
friend ostream&operator<<(ostream&os,Mont&x){return os<<x.get();}
};
}
namespace Mont64{
inline constexpr unsigned long long getroot1(long long MOD){unsigned long long iv=MOD;for(register unsigned i=0;i!=5;++i){iv*=2ULL-MOD*iv;}return iv;}
inline constexpr unsigned long long getroot2(long long MOD){unsigned long long iv=-(unsigned long long)(MOD)%MOD;for(register unsigned i=0;i!=64;++i){if(MOD<=(iv<<=1)){iv-=MOD;}}return iv;}
template<long long MOD>struct Mont{
private:
unsigned long long v;
static constexpr unsigned long long r1=getroot1(MOD);static constexpr unsigned long long r2=getroot2(MOD);static_assert((MOD&1)==1);static_assert(r1*MOD==1);static_assert(MOD<(1ULL<<63));
inline static pair<unsigned long long,unsigned long long>mul(unsigned long long x,unsigned long long y){unsigned long long a=x>>32,b=(unsigned)(x),c=y>>32,d=(unsigned)(y),ac=a*c,bd=b*d,ad=a*d,bc=b*c;return make_pair(ac+(ad>>32)+(bc>>32)+((ad&-1U)+(bc&-1U)+(bd>>32)>>32),bd+(ad+bc<<32));}
inline static unsigned long long mulhi(unsigned long long x,unsigned long long y){unsigned long long a=x>>32,b=(unsigned)(x),c=y>>32,d=(unsigned)(y),ac=a*c,bd=b*d,ad=a*d,bc=b*c;return ac+(ad>>32)+(bc>>32)+((ad&-1U)+(bc&-1U)+(bd>>32)>>32);}
inline static unsigned long long reduce(const pair<unsigned long long,unsigned long long>&x){unsigned long long ans=x.first-mulhi(x.second*r1,MOD);return ans+(MOD&-(ans>>63));}
inline static unsigned long long ksmmod(unsigned long long x,unsigned long long y){unsigned long long ans=reduce(make_pair(0,r2));for(x=reduce(mul(x,r2));y!=0;y>>=1,x=reduce(mul(x,x))){if(y&1){ans=reduce(mul(ans,x));}}return reduce(make_pair(0,ans));}
public:
inline static unsigned long long primitive(){unsigned long long tmp[128]={},cnt=0;constexpr unsigned long long phi=MOD-1;unsigned long long m=phi;for(register unsigned long long i=2;i*i<=m;++i){if(m%i==0){tmp[cnt++]=i;while(m%i==0){m/=i;}}}if(m!=1){tmp[cnt++]=m;}for(register unsigned long long ans=2;ans!=MOD;++ans){bool flag=true;for(register unsigned i=0;i!=cnt&&flag;++i){flag&=ksmmod(ans,phi/tmp[i])!=1;}if(flag){return ans;}}return 0;}
Mont()=default;
~Mont()=default;
Mont(unsigned long long v):v(reduce(mul(v,r2))){}
Mont(const Mont&x):v(x.v){}
inline long long getP()const{return MOD;}
inline unsigned long long get()const{return reduce(make_pair(0,v));}
explicit operator long long()const{return(long long)(get());}
explicit operator unsigned long long()const{return get();}
Mont Inv()const{long long x1=1,x3=0,a=get(),b=MOD;while(b!=0){long long q=a/b;tie(x1,x3)=make_tuple(x3,x1-x3*q);tie(a,b)=make_tuple(b,a-b*q);}return Mont(x1+MOD);}
Mont operator-()const{Mont ans;return ans.v=(MOD&-(v!=0))-v,ans;}
Mont&operator*=(const Mont&x){return v=reduce(mul(v,x.v)),*this;}
Mont&operator+=(const Mont&x){return v+=x.v-MOD,v+=MOD&-(v>>63),*this;}
Mont&operator-=(const Mont&x){return v-=x.v,v+=MOD&-(v>>63),*this;}
Mont&operator/=(const Mont&x){return this->operator*=(x.Inv());}
#define stO(op) friend Mont operator op(const Mont&x,const Mont&y){return Mont(x)op##=y;}
stO(+)stO(-)stO(*)stO(/)
#undef stO
#define stO(op) friend bool operator op(const Mont&x,const Mont&y){return reduce(make_pair(0,x.v))op reduce(make_pair(0,y.v));}
stO(==)stO(!=)stO(>)stO(<)stO(>=)stO(<=)
#undef stO
Mont&operator++(){*this+=1;return*this;}
Mont&operator--(){*this-=1;return*this;}
Mont operator++(int){Mont ans(*this);*this+=1;return ans;}
Mont operator--(int){Mont ans(*this);*this-=1;return ans;}
friend istream&operator>>(istream&is,Mont&x){return is>>x.v,x.v=reduce(mul(x.v,r2)),is;}
friend ostream&operator<<(ostream&os,Mont&x){return os<<x.get();}
Mont Ksm(long long b){Mont ans=1,a=get();while(b){if(b&1){ans=ans*a;}a=a*a;b>>=1;}return ans;}
};
}
namespace DynamicMont{
using Tp=long long;
struct Barrett{
bool f;long long coef,p;
inline void Setp(long long P){coef=((__int128)1<<64)/(p=P);}
long long operator() (const long long &x){return PR?x-(((__int128)x*coef)>>64)*p:(x>=2*p?x%p:x>=p&&x<2*p?x-p:x>=0&&x<p?x:x<0&&x>-p?x+p:x%p+p);}
}Rec;
template<int DM>struct Mont{
static Tp MOD;Tp v;
Mont()=default;
~Mont()=default;
static void Setp(Tp p){MOD=p;Rec.Setp(MOD);}
inline Tp getP(){return MOD;}
inline Tp get(){Mont ans=*this;return ans.v;}
template<class T>inline Tp reduce(const T &x){Tp ans=Rec(x);return ans<0?ans+MOD:ans;}
template<class T>Mont(const T&x):v(reduce(x)){}
Mont operator-()const{return Mont(v?MOD-v:0);}
Mont&operator+=(const Mont&x){return v=reduce(v+x.v),*this;}
Mont&operator-=(const Mont&x){return v=reduce(v-x.v),*this;}
Mont&operator*=(const Mont&x){return v=reduce(v*x.v),*this;}
Mont&operator/=(const Mont&x){return*this*=x.Inv();}
#define stO(op) friend Mont operator op(const Mont&x,const Mont&y){return Mont(x)op##=y;}
stO(+)stO(-)stO(*)stO(/)
#undef stO
#define stO(op) friend bool operator op(const Mont&x,const Mont&y){return x.v op y.v;}
stO(==)stO(!=)stO(>)stO(<)stO(>=)stO(<=)
#undef stO
Mont&operator++(){*this+=1;return*this;}
Mont&operator--(){*this-=1;return*this;}
Mont operator++(int){Mont ans(*this);*this+=1;return ans;}
Mont operator--(int){Mont ans(*this);*this-=1;return ans;}
Mont Ksm(long long b)const{Mont ans=1,a=*this;while(b){if(b&1){ans=ans*a;}a=a*a;b>>=1;}return ans;}
Mont Inv()const{return Ksm(MOD-2);}
};
template<int DM>Tp Mont<DM>::MOD;
}
#if (defined Modulus_Const)&&(defined Modulus_Prime)
using namespace Mont64;
constexpr long long MD=998244353;
using DZ=Mont<MD>;
// inline long long Get(long long x){return x>=0?x:x<-MOD?x%MOD+MOD:x+MOD;}
// use this often,it's safe.
#else
using namespace DynamicMont;
using DZ=Mont<-1 >;
struct WarnDynamic{WarnDynamic(){cerr<<"Your mod is not constant, so you can only use DynamicMont, remember to set your mod !"<<endl;}}WarnDY;
#endif
namespace Mathematics{
struct Combination{
int n;long long P;vector<DZ>inv,fac,ifac;
Combination(int lim,long long M):n(lim){P=M;inv=vector<DZ>(lim+3);fac=vector<DZ>(lim+3);ifac=vector<DZ>(lim+3);Init();}
inline void Init(){fac[0]=ifac[0]=1;inv[1]=fac[1]=ifac[1]=1;for(register int i=2;i<=n;++i){inv[i]=DZ(P)-DZ(P/i)*inv[P%i];fac[i]=fac[i-1]*i;ifac[i]=ifac[i-1]*inv[i];}return void();}
inline DZ Inv(long long x){return inv[x];}
inline DZ Fac(long long x){return fac[x];}
inline DZ Ifac(long long x){return ifac[x];}
inline DZ A(long long x,long long y){return x<y||x<0||y<0?0:fac[x]*ifac[y];}
inline DZ C(long long x,long long y){return x<y||x<0||y<0?0:fac[x]*ifac[y]*ifac[x-y];}
};
}
using namespace Mathematics;
}
#else
namespace Montgomery{
#define Modulus_Const
#define Modulus_Prime
//if modulus is const,open Montgomery Fast Version.
//if modulus is not const,open Dynamic Fast Version,if modulus is not prime,open Dynamic Modulus Version.
#ifdef Modulus_Prime
bool PR=true;
#else
bool PR=false;
#endif
namespace DynamicMont{
using Tp=long long;
struct Barrett{
bool f;long long coef,p;
inline void Setp(long long P){coef=((__int128)1<<64)/(p=P);}
long long operator() (const long long &x){return PR?x-(((__int128)x*coef)>>64)*p:(x>=2*p?x%p:x>=p&&x<2*p?x-p:x>=0&&x<p?x:x<0&&x>-p?x+p:x%p+p);}
}Rec;
template<int DM>struct Mont{
static Tp MOD;Tp v;
Mont()=default;
~Mont()=default;
static void Setp(Tp p){MOD=p;Rec.Setp(MOD);}
inline Tp getP(){return MOD;}
inline Tp get(){Mont ans=*this;return ans.v;}
template<class T>inline Tp reduce(const T &x){Tp ans=Rec(x);return ans<0?ans+MOD:ans;}
template<class T>Mont(const T&x):v(reduce(x)){}
Mont operator-()const{return Mont(v?MOD-v:0);}
Mont&operator+=(const Mont&x){return v=reduce(v+x.v),*this;}
Mont&operator-=(const Mont&x){return v=reduce(v-x.v),*this;}
Mont&operator*=(const Mont&x){return v=reduce(v*x.v),*this;}
Mont&operator/=(const Mont&x){return*this*=x.Inv();}
#define stO(op) friend Mont operator op(const Mont&x,const Mont&y){return Mont(x)op##=y;}
stO(+)stO(-)stO(*)stO(/)
#undef stO
#define stO(op) friend bool operator op(const Mont&x,const Mont&y){return x.v op y.v;}
stO(==)stO(!=)stO(>)stO(<)stO(>=)stO(<=)
#undef stO
Mont&operator++(){*this+=1;return*this;}
Mont&operator--(){*this-=1;return*this;}
Mont operator++(int){Mont ans(*this);*this+=1;return ans;}
Mont operator--(int){Mont ans(*this);*this-=1;return ans;}
Mont Ksm(long long b)const{Mont ans=1,a=*this;while(b){if(b&1){ans=ans*a;}a=a*a;b>>=1;}return ans;}
Mont Inv()const{return Ksm(MOD-2);}
};
template<int DM>Tp Mont<DM>::MOD;
}
using namespace DynamicMont;
#if (defined Modulus_Const)&&(defined Modulus_Prime)
constexpr long long MD=998244353;
using DZ=Mont<-1>;
struct SetMod{SetMod(){DZ::Setp(MD);}}SetMOD;
struct WarnDynamic{WarnDynamic(){cerr<<"Your C++ version is lower than 17, so you can only use DynamicMont, remember to set your mod !"<<endl;}}WarnDY;
#else
using DZ=Mont<-1>;
struct WarnDynamic{WarnDynamic(){cerr<<"Your C++ version is lower than 17, so you can only use DynamicMont, remember to set your mod !"<<endl;}}WarnDY;
#endif
namespace Mathematics{
struct Combination{
int n;long long P;vector<DZ>inv,fac,ifac;
Combination(int lim,long long M):n(lim){P=M;inv=vector<DZ>(lim+3);fac=vector<DZ>(lim+3);ifac=vector<DZ>(lim+3);Init();}
inline void Init(){fac[0]=ifac[0]=1;inv[1]=fac[1]=ifac[1]=1;for(register int i=2;i<=n;++i){inv[i]=DZ(P)-DZ(P/i)*inv[P%i];fac[i]=fac[i-1]*i;ifac[i]=ifac[i-1]*inv[i];}return void();}
inline DZ Inv(long long x){return inv[x];}
inline DZ Fac(long long x){return fac[x];}
inline DZ Ifac(long long x){return ifac[x];}
inline DZ A(long long x,long long y){return x<y||x<0||y<0?0:fac[x]*ifac[y];}
inline DZ C(long long x,long long y){return x<y||x<0||y<0?0:fac[x]*ifac[y]*ifac[x-y];}
};
}
using namespace Mathematics;
}
#endif
using namespace Montgomery;
/*
Good Luck!
Have Fun!
CSPS RP++
NOIP RP++
OI RP++
NOI RP++
CTT RP++
CTS RP++
IOI RP++
ZKA RP++
GKA RP++
KAY RP++
KAB RP++
WHK RP++
Goal:
CF GM
AT 2DAN
LG Lv9
To be continued...
*/
// ___
// /\_ \
// ___ __ __ __ _ \//\ \ ___ __ __ __ ____ __ ___ ___ __ _
// /'___\/\ \/\ \ /\ \/'\ \ \ \ / __`\/\ \/\ \ /'__`\ /',__\ /'_ `\ /' __` __`\ /\ \/'\
// /\ \__/\ \ \_\ \\/> </ \_\ \_/\ \L\ \ \ \_/ |/\ __//\__, `\ /\ \L\ \/\ \/\ \/\ \\/> </
// \ \____\\/`____ \/\_/\_\ /\____\ \____/\ \___/ \ \____\/\____/ \ \____ \ \_\ \_\ \_\/\_/\_\
// \/____/ `/___/> \//\/_/ \/____/\/___/ \/__/ \/____/\/___/ \/___L\ \/_/\/_/\/_/\//\/_/
// /\___/ /\____/
// \/__/ \_/__/
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
//.......RRRRRRRRRRRRRRRRRRRR...................PPPPPPPPPPPPPPPPPPPP...............................................
//.......RRRRRRRRRRRRRRRRRRRRRR.................PPPPPPPPPPPPPPPPPPPPPP.............................................
//.......RRRRRRRRRRRRRRRRRRRRRRR................PPPPPPPPPPPPPPPPPPPPPPPP...........................................
//.......RRRR.................RRRRR.............PPPP...............PPPPP...........................................
//.......RRRR.................RRRRR.............PPPP................PPPPP..........................................
//.......RRRR.................RRRRR.............PPPP................PPPPP..........................................
//.......RRRR...............RRRRR...............PPPP...............PPPPP...........................................
//.......RRRR............RRRRRR.................PPPP.............PPPPPP............................................
//.......RRRR............RRRRRR.................PPPP............PPPPPP.............................................
//.......RRRR........RRRRRR.....................PPPP........PPPPPPP................................................
//.......RRRRRRRRRRRRRRRRRR.....................PPPPPPPPPPPPPPPPPP.................................................
//.......RRRRRRRRRRRRRRRRRR.....................PPPPPPPPPPPPPPPP...................................................
//.......RRRR..........RRRR.....................PPPPP.................................+++................+++.......
//.......RRRR...........RRRR....................PPPPP.................................+++................+++.......
//.......RRRR.............RRRR..................PPPPP.................................+++................+++.......
//.......RRRR..............RRRR.................PPPPP...........................+++++++++++++++....+++++++++++++++.
//.......RRRR...............RRRR................PPPPP...........................+++++++++++++++....+++++++++++++++.
//.......RRRR................RRRR...............PPPPP.................................+++................+++.......
//.......RRRR.................RRRR..............PPPPP.................................+++................+++.......
//.......RRRR...................RRRR............PPPPP.................................+++................+++.......
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
//.................................................................................................................
using tp=long long;
using i16=short;
using i64=long long;
using i128=__int128;
using u16=unsigned short;
using u32=unsigned;
using u64=unsigned long long;
using u128=unsigned __int128;
using d32=double;
using d64=long double;
using d128=__float128;
template<class T,class Q>using pr=pair<T,Q>;
template<class T=tp,size_t x=3>using ar=array<T,x>;
template<class T=tp>using vc=vector<T>;
template<class T=tp>using vvc=vector<vc<T>>;
template<class T=tp>using vvvc=vector<vvc<T>>;
template<class T=tp>using vvvvc=vector<vvvc<T>>;
template<class T=tp>using vvvvvc=vector<vvvvc<T>>;
template<class T=tp>using pqueue=priority_queue<T>;
template<class T=tp>using bqueue=priority_queue<T,vector<T>,greater<T>>;
template<class T=tp,class Q=tp,class R=tp>using tup=tuple<T,Q,R>;
template<class T=tp,class Q=tp,class R=tp,class S=tp>using ttup=tuple<T,Q,R,S>;
template<class T=tp,class Q=tp,class R=tp,class S=tp,class U=tp>using tttup=tuple<T,Q,R,S,U>;
#define CurClock(T) static_cast<T>(chrono::steady_clock::now().time_since_epoch().count())
#define mtset(T) multiset<T>
#define mtmap(T,S) multimap<T,S>
#define umap(T,S) unordered_map<T,S>
#define uset(T) unordered_set<T>
#define umset(T) unordered_multiset<T>
#define Treap(T) __gnu_pbds::tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>
#define HashTable(T,Func) __gnu_pbds::gp_hash_table<T,T,Func>
#define FibHeap(T,Cmp) __gnu_pbds::priority_queue<T,Cmp,thin_heap_tag>
#define PairHeap(T,Cmp) __gnu_pbds::priority_queue<T,Cmp,pairing_heap_tag>
#define vv(T,G,a,...) vvc<T>G(a,vc<T>(__VA_ARGS__))
#define vvv(T,G,a,b,...) vvvc<T>G(a,vvc<T>(b,vc<T>(__VA_ARGS__)))
#define vvvv(T,G,a,b,c,...) vvvvc<T>G(a,vvvc<T>(b,vvc<T>(c,vc<T>(__VA_ARGS__))))
#define vvvvv(T,G,a,b,c,d,...) vvvvvc<T>G(a,vvvvc<T>(b,vvvc<T>(c,vvc<T>(d,vc<T>(__VA_ARGS__)))))
using pt=pr<tp,tp>;
using ar3=ar<tp,3>;
using ar4=ar<tp,4>;
[[maybe_unused]]constexpr long long N=1000100;bool MultiCase;
inline int SolveMain([[maybe_unused]]long long TC);
inline void InitMain();
#if 1
int main(){
// OF("test");
InitMain();
Test()SolveMain(TestCase);
return 0;
}
#endif
inline void InitMain(){
MultiCase=false;
return void();
}
#if 0
1. close Buffer when meeting interactive problems, flush when output.
2. check files when meeting file IO problems.
3. check the size of vectors, and the memory.
4. long long is slower than int, do not use it when the coef is big.
5. delete Debug code or use "//" or "/**/" or "#if 0".
6. initialize, especially "tp a[...]={}", it can cause weird errors.
7. think twice, code once, especially ad-hoc, maths, dp, constructive problems.
8. think of "[l,r]" of Binarysearch, and the "ans's" special value.
9. make special datas and the limit data when "Duipai", try to make the strongest data you can think.
10. notice int overflow(use long long), long long overflow(use __int128)/MLE(use int or bitfield).
To be continued...
To be continued...
To be continued...
To be continued...
To be continued...
To be continued...
To be continued...
To be continued...
To be continued...
CSPJRP++
CSPSRP++
NOIPRP++
FJOIRP++
NOIRP++
CTTRP++
CTSRP++
IOIRP++
THUSC/THUWCRP++
PKUSC/PKUWCRP++
#endif
tp ans;
bitset<5050>a[30<<1];
inline int SolveMain([[maybe_unused]]long long TC){
RD(n);
For(n){
RD(k);
RV(a,k);
SOR(a,1);
bitset<5050>vis;
For(j,k){bitset<5050>$;
For(l,a[j-1]+1,a[j])$|=::a[l];vis^=$;}
ans+=vis.count();For(j,k)::a[a[j]][i]=true;
}
write(ans);
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
2 1 1 2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 2 1 2 2 2 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 1 1 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
3 2 3 1 3 3 1 2 3 1 2 3
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
3 2 1 2 2 2 1 2 1 3
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 3 2 1 3 1 1 3 3 2 1 3 3 2 1
output:
6
result:
ok 1 number(s): "6"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
4 1 3 3 3 1 2 3 2 1 3 1 2
output:
5
result:
ok 1 number(s): "5"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
5 1 2 1 2 2 3 4 4 4 1 2 3 1 3
output:
9
result:
ok 1 number(s): "9"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
10 3 3 4 1 3 3 2 4 5 5 4 2 3 1 4 2 1 3 4 2 5 2 3 5 3 1 3 5 3 4 5 4 3 2 5 1 5 3 2 4 5 1 5 5 1 3 4 2
output:
27
result:
ok 1 number(s): "27"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
50 5 3 5 1 4 2 5 5 3 4 2 1 4 3 1 4 5 1 1 5 1 2 3 4 5 3 2 4 1 5 4 5 3 2 1 3 2 5 3 3 1 5 4 5 5 2 3 4 1 5 1 5 4 3 2 4 5 2 1 4 4 5 2 4 1 4 4 1 2 5 3 2 3 1 4 5 2 1 3 3 5 1 4 5 4 3 5 2 1 1 2 4 5 2 1 3 2 2 4 2 4 2 1 1 1 2 1 4 2 4 2 4 1 4 3 2 4 1 4 3 5 2 3 1 3 4 1 3 2 1 2 3 5 2 4 2 2 1 4 1 4 3 2 4 1 2 4 5 1...
output:
721
result:
ok 1 number(s): "721"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
50 7 2 10 9 5 6 3 1 10 1 6 4 7 9 2 10 3 8 5 10 2 1 10 7 8 4 6 3 9 5 4 3 8 9 5 3 4 5 2 10 3 7 1 4 10 2 9 5 6 8 5 1 9 3 4 7 8 2 5 3 8 6 4 7 1 1 10 10 3 8 6 2 9 10 4 5 1 7 7 4 10 9 8 6 3 2 8 4 9 6 3 1 7 10 5 7 10 5 6 3 4 1 7 9 3 1 10 8 7 6 4 2 5 2 1 2 7 3 5 8 4 1 2 10 5 8 2 3 10 5 10 10 2 8 1 5 3 4 7 9...
output:
596
result:
ok 1 number(s): "596"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
300 11 14 7 1 15 13 19 6 20 11 3 17 19 4 8 2 15 6 11 12 9 16 13 17 7 14 20 3 10 19 18 1 3 7 5 6 2 19 5 5 18 20 16 7 2 11 1 8 2 6 16 19 15 20 11 12 14 8 17 6 19 9 7 1 12 10 20 20 15 4 18 12 6 2 19 14 10 17 9 13 11 5 8 16 7 1 3 8 5 20 16 18 11 8 2 14 9 14 2 17 4 12 19 20 18 7 10 9 20 10 16 2 18 11 5 4...
output:
23348
result:
ok 1 number(s): "23348"
Test #13:
score: 0
Accepted
time: 18ms
memory: 3904kb
input:
5000 10 28 4 20 14 40 26 3 18 50 23 22 19 18 7 15 4 28 39 22 17 37 42 41 10 27 9 50 47 14 49 35 34 44 25 46 28 16 12 6 33 18 13 27 4 35 38 31 14 25 3 19 30 7 49 11 1 2 42 29 30 15 45 20 1 22 28 8 47 16 36 13 17 6 48 46 12 7 43 19 42 11 30 27 31 3 2 44 49 23 32 47 11 10 35 32 21 46 50 9 3 24 20 12 13...
output:
6339644
result:
ok 1 number(s): "6339644"
Test #14:
score: 0
Accepted
time: 22ms
memory: 4208kb
input:
5000 6 32 20 23 43 10 9 31 26 24 23 35 41 12 6 28 33 46 38 40 47 17 34 31 18 42 5 22 20 29 48 21 4 15 43 36 14 39 45 18 4 15 16 40 1 47 22 9 43 39 21 41 20 48 28 6 8 14 31 32 44 30 18 16 26 24 23 12 4 31 1 42 38 5 33 2 13 34 25 11 46 17 10 47 21 35 7 43 48 29 21 4 42 22 10 40 25 48 47 29 1 26 32 7 3...
output:
6257845
result:
ok 1 number(s): "6257845"
Test #15:
score: 0
Accepted
time: 22ms
memory: 4180kb
input:
5000 48 45 31 6 5 50 15 2 36 32 33 8 27 47 22 43 7 19 39 11 46 18 21 3 26 28 9 41 37 42 12 23 16 13 1 49 20 25 10 34 17 14 48 44 4 24 35 29 40 44 34 30 49 43 22 37 5 39 21 13 45 48 14 16 38 40 33 27 26 10 17 2 15 12 46 29 50 18 9 36 44 47 28 41 20 35 23 11 8 42 32 25 4 19 43 28 43 11 20 40 5 48 42 3...
output:
6417920
result:
ok 1 number(s): "6417920"
Test #16:
score: 0
Accepted
time: 22ms
memory: 4020kb
input:
5000 48 7 12 22 10 50 18 8 34 3 14 28 1 37 19 42 4 17 43 24 39 16 11 44 41 45 49 31 36 25 46 32 5 23 33 35 27 47 21 15 38 20 6 30 48 29 26 40 2 28 42 33 10 20 47 19 16 23 4 29 49 9 18 34 6 12 48 25 46 13 31 1 2 44 40 15 11 24 22 14 6 19 46 9 48 18 30 24 34 37 23 4 27 3 5 12 33 50 15 41 1 8 9 46 37 5...
output:
6362284
result:
ok 1 number(s): "6362284"
Test #17:
score: 0
Accepted
time: 21ms
memory: 4012kb
input:
5000 37 16 31 32 33 38 45 39 21 24 41 6 28 48 17 10 49 27 35 29 25 3 23 44 5 9 34 14 37 13 36 42 40 7 19 8 18 1 28 30 45 20 21 48 12 15 11 39 7 42 23 4 5 22 16 40 44 1 38 17 50 2 41 26 14 24 3 42 26 42 38 23 8 33 12 17 24 20 14 49 22 28 19 4 50 18 13 10 3 15 35 47 40 30 11 32 48 29 21 46 5 41 6 44 4...
output:
6389648
result:
ok 1 number(s): "6389648"
Test #18:
score: 0
Accepted
time: 22ms
memory: 4264kb
input:
5000 3 4 22 11 26 30 46 15 4 29 10 50 14 38 7 18 28 17 2 23 24 8 11 9 21 6 26 5 43 34 41 31 24 16 3 13 7 47 25 12 49 34 50 46 18 1 2 20 37 36 33 31 11 32 44 8 30 15 42 39 26 9 4 35 15 19 6 41 49 45 47 31 44 2 29 25 20 36 32 22 43 4 50 39 10 27 9 28 3 42 16 21 18 40 38 14 48 34 17 50 14 17 7 26 23 35...
output:
6457040
result:
ok 1 number(s): "6457040"
Test #19:
score: 0
Accepted
time: 21ms
memory: 4016kb
input:
5000 24 27 15 12 42 31 45 49 10 46 1 14 21 28 40 9 3 35 43 6 34 11 32 2 24 30 10 6 22 37 5 9 8 19 41 26 27 16 7 23 35 2 12 49 40 14 44 46 45 32 18 47 39 33 24 31 41 22 34 19 16 4 21 31 45 18 5 50 14 12 27 42 13 15 29 28 43 10 32 1 35 24 17 26 9 46 40 39 38 48 7 6 25 23 47 3 41 33 27 11 10 40 38 45 4...
output:
6389257
result:
ok 1 number(s): "6389257"
Test #20:
score: 0
Accepted
time: 21ms
memory: 4044kb
input:
5000 37 38 7 8 41 20 47 23 18 40 14 3 39 30 45 44 49 13 27 33 19 42 34 4 28 12 2 43 6 35 29 16 1 17 10 11 26 15 24 42 23 33 1 31 10 3 18 4 38 32 13 50 19 47 24 22 11 20 5 49 7 29 35 12 1 41 21 39 10 5 42 7 36 35 4 32 45 6 21 8 31 2 36 47 7 33 43 10 22 20 13 23 37 19 28 3 49 16 30 32 44 35 26 14 29 4...
output:
6434201
result:
ok 1 number(s): "6434201"
Test #21:
score: 0
Accepted
time: 22ms
memory: 3940kb
input:
5000 23 19 14 45 38 32 22 39 30 17 4 6 5 50 44 15 42 1 23 33 29 26 16 10 20 30 31 3 27 37 36 7 10 1 8 6 33 14 47 11 22 26 34 16 50 10 33 37 16 28 47 23 6 40 41 9 2 45 30 13 18 11 30 5 42 35 38 20 21 14 29 25 46 11 40 22 31 42 32 48 49 12 4 13 33 47 12 48 29 2 42 10 34 15 18 24 21 45 8 28 14 32 30 23...
output:
6376130
result:
ok 1 number(s): "6376130"
Test #22:
score: 0
Accepted
time: 18ms
memory: 4052kb
input:
5000 17 32 21 42 36 5 30 9 46 48 29 15 26 19 39 4 16 35 40 15 39 35 47 44 13 14 17 45 25 40 49 7 50 12 19 43 20 5 26 9 21 6 1 46 10 11 41 4 37 33 18 32 23 42 29 48 3 34 8 22 6 49 50 19 18 3 34 24 38 30 10 11 41 22 42 31 12 21 15 23 40 13 6 39 35 50 28 8 38 21 37 20 4 15 22 48 29 18 44 14 10 24 42 41...
output:
6405143
result:
ok 1 number(s): "6405143"
Test #23:
score: 0
Accepted
time: 21ms
memory: 3980kb
input:
5000 14 31 4 40 38 39 11 47 50 29 24 16 34 36 8 11 20 50 33 37 1 18 25 9 23 49 22 8 3 36 35 49 34 31 14 12 10 34 14 21 26 12 45 2 44 16 50 6 12 37 14 42 50 24 22 41 17 39 28 50 40 42 37 12 38 9 32 5 48 36 21 22 3 16 11 30 19 19 33 35 20 42 19 32 43 6 40 24 13 31 48 22 23 10 15 12 17 46 23 27 28 30 5...
output:
6369827
result:
ok 1 number(s): "6369827"
Test #24:
score: 0
Accepted
time: 21ms
memory: 4044kb
input:
5000 13 17 5 34 26 6 37 3 48 39 25 8 28 24 31 30 11 6 3 46 20 38 12 4 15 45 40 24 5 17 9 29 47 32 28 21 26 8 19 42 2 27 14 49 44 33 32 27 43 44 32 26 41 16 33 19 22 8 3 11 39 49 29 20 42 34 24 14 38 35 12 18 4 10 30 9 28 6 25 19 6 4 28 24 21 26 36 35 48 13 46 32 19 5 47 25 49 8 29 13 6 29 40 31 48 1...
output:
6358323
result:
ok 1 number(s): "6358323"
Test #25:
score: 0
Accepted
time: 22ms
memory: 4028kb
input:
5000 44 36 14 35 9 47 20 42 16 34 41 24 13 12 6 46 23 15 22 48 25 43 29 21 39 26 3 2 44 33 38 10 50 4 8 7 27 28 49 37 1 19 45 32 40 19 36 30 43 20 13 42 46 31 1 32 17 9 24 22 44 6 5 35 25 29 44 33 20 37 35 10 13 27 45 18 22 11 34 50 16 2 21 4 48 19 1 40 9 23 43 49 42 39 15 50 2 27 34 14 24 18 8 29 1...
output:
6405879
result:
ok 1 number(s): "6405879"
Test #26:
score: 0
Accepted
time: 22ms
memory: 4016kb
input:
5000 6 13 15 29 42 23 30 32 1 20 24 21 15 35 43 32 12 33 47 3 6 40 22 28 26 42 49 8 13 14 48 10 7 16 4 41 25 31 37 27 12 32 25 34 19 42 41 16 26 4 35 6 14 13 45 39 10 13 3 19 20 30 5 46 47 1 17 33 36 15 34 22 9 49 16 19 47 4 14 35 3 42 45 10 40 18 28 33 27 26 8 5 23 46 38 12 29 50 30 44 7 12 34 27 5...
output:
6401832
result:
ok 1 number(s): "6401832"
Test #27:
score: 0
Accepted
time: 21ms
memory: 3948kb
input:
5000 41 10 5 8 46 14 30 4 39 16 12 29 26 38 47 35 22 31 49 24 33 13 11 42 20 18 37 17 28 15 32 3 45 9 43 34 41 40 2 6 25 36 17 7 13 15 39 28 26 1 23 27 9 38 29 48 36 30 11 43 23 18 31 5 30 27 24 28 26 23 25 3 19 20 21 1 36 41 7 16 35 12 4 43 4 32 19 36 16 41 6 29 5 8 24 3 34 43 18 47 11 42 4 22 36 4...
output:
6375277
result:
ok 1 number(s): "6375277"
Test #28:
score: 0
Accepted
time: 21ms
memory: 4184kb
input:
5000 11 21 27 3 19 41 26 9 17 30 33 37 43 16 32 6 18 35 47 39 29 5 10 28 1 38 4 15 45 31 14 11 23 44 40 30 49 24 8 25 41 13 27 9 22 12 43 19 46 34 48 33 26 36 50 37 7 50 11 42 30 25 19 48 12 47 19 21 3 37 41 24 32 44 40 29 39 50 36 12 22 3 17 41 11 37 2 16 15 7 29 14 34 19 43 4 46 49 32 50 24 21 6 3...
output:
6331860
result:
ok 1 number(s): "6331860"
Test #29:
score: 0
Accepted
time: 22ms
memory: 4016kb
input:
5000 43 5 13 31 12 41 21 28 19 4 35 2 29 6 25 27 33 37 18 20 39 43 10 22 23 42 44 15 3 8 48 14 32 49 34 7 38 11 36 17 46 16 45 50 30 24 26 2 35 29 8 43 15 45 4 16 11 38 46 41 36 10 40 5 3 28 18 14 22 13 19 42 6 23 33 31 28 20 10 43 50 48 37 21 18 30 35 38 7 47 5 25 12 11 16 32 29 49 34 23 39 2 41 13...
output:
6339756
result:
ok 1 number(s): "6339756"
Test #30:
score: 0
Accepted
time: 18ms
memory: 3948kb
input:
5000 31 2 49 19 23 28 39 9 32 40 36 18 22 33 21 50 3 6 45 44 26 30 41 31 42 5 48 7 16 27 46 1 45 11 47 34 39 8 18 42 24 46 36 35 49 44 33 22 40 14 1 4 25 20 12 16 37 17 38 29 6 13 9 10 28 3 5 31 43 26 2 19 32 15 50 27 21 23 50 47 50 12 10 20 25 24 15 8 35 37 2 34 13 28 32 7 40 27 44 48 31 29 16 38 3...
output:
6394429
result:
ok 1 number(s): "6394429"
Test #31:
score: 0
Accepted
time: 22ms
memory: 4016kb
input:
5000 35 21 20 18 22 37 44 47 32 17 8 6 30 15 2 24 33 48 5 26 50 11 39 34 23 40 42 38 29 10 45 25 41 14 35 19 45 24 41 47 39 5 32 18 12 33 19 4 36 14 1 46 40 9 48 17 6 43 15 10 38 27 45 26 8 21 34 35 2 16 28 50 20 42 22 23 31 25 49 3 37 11 27 10 28 44 43 23 7 47 46 34 16 40 18 3 6 42 38 9 22 11 48 1 ...
output:
6434432
result:
ok 1 number(s): "6434432"
Test #32:
score: 0
Accepted
time: 21ms
memory: 4008kb
input:
5000 11 5 35 46 23 50 42 21 14 2 22 20 2 41 35 38 5 3 42 31 35 37 30 4 39 49 9 24 46 13 32 29 40 12 25 34 1 6 23 47 10 21 14 33 27 17 20 48 44 18 36 22 50 28 7 1 38 22 35 23 6 25 22 27 31 48 43 41 32 14 16 22 11 34 36 5 8 40 2 6 15 20 9 28 33 4 40 26 3 30 8 16 15 49 45 17 46 19 29 11 5 33 7 20 36 40...
output:
6452445
result:
ok 1 number(s): "6452445"
Test #33:
score: 0
Accepted
time: 21ms
memory: 3992kb
input:
5000 37 27 8 34 36 12 26 7 31 23 16 10 5 4 43 44 1 41 42 22 3 37 6 2 19 24 50 35 29 46 11 28 39 13 21 15 45 47 14 49 48 9 31 50 38 20 32 19 8 44 33 7 28 9 32 6 50 22 34 26 13 27 46 35 49 4 36 21 3 26 32 45 47 37 38 20 19 12 18 9 41 33 39 27 6 48 31 1 11 40 10 7 30 14 17 22 50 42 29 41 44 18 49 1 33 ...
output:
6352997
result:
ok 1 number(s): "6352997"
Test #34:
score: 0
Accepted
time: 21ms
memory: 4260kb
input:
5000 10 22 15 30 13 6 18 21 1 8 12 23 36 4 29 44 20 7 42 49 24 21 2 8 41 1 17 40 16 45 19 35 28 10 12 30 39 44 3 27 33 29 22 8 12 48 45 34 18 1 11 19 9 13 38 32 37 14 2 4 10 50 15 36 21 7 49 41 22 11 8 21 15 33 35 48 12 23 16 38 26 2 27 24 32 18 34 19 43 28 44 3 47 7 29 37 4 36 30 49 13 31 46 9 39 1...
output:
6368672
result:
ok 1 number(s): "6368672"
Test #35:
score: 0
Accepted
time: 18ms
memory: 3948kb
input:
5000 2 29 37 40 1 22 23 18 7 14 15 3 20 26 41 21 46 37 32 8 11 42 24 9 13 2 50 43 12 28 6 27 25 34 49 45 48 19 38 10 31 4 36 47 5 33 17 13 48 28 40 36 9 47 46 22 25 30 6 31 27 12 48 50 37 7 5 45 34 43 16 49 8 44 13 18 33 38 17 15 41 35 40 23 19 4 42 2 32 10 26 16 42 32 19 39 29 1 38 11 25 35 34 37 1...
output:
6334147
result:
ok 1 number(s): "6334147"
Test #36:
score: 0
Accepted
time: 22ms
memory: 3948kb
input:
5000 28 50 1 25 19 9 41 26 39 37 44 6 30 46 10 42 16 31 40 43 4 28 38 35 11 47 32 29 23 30 45 37 46 35 16 48 7 21 2 30 40 49 50 3 27 4 15 10 42 26 41 31 29 47 11 19 39 18 14 8 19 3 2 29 50 12 36 39 19 14 20 23 44 1 11 43 7 25 31 21 28 14 44 12 19 7 48 10 37 25 31 27 49 30 24 32 22 36 40 50 35 13 26 ...
output:
6437648
result:
ok 1 number(s): "6437648"
Test #37:
score: 0
Accepted
time: 21ms
memory: 3900kb
input:
5000 20 5 7 17 15 26 40 24 42 32 2 23 14 12 4 19 50 25 13 33 9 22 17 39 14 23 41 38 47 21 50 35 13 43 22 10 45 9 24 18 33 4 46 26 9 45 17 1 30 49 12 13 9 38 9 30 42 3 38 47 21 1 6 39 33 39 21 40 1 3 30 31 19 47 5 8 26 35 11 49 13 6 23 24 36 42 10 41 20 45 38 9 27 2 28 12 25 16 8 50 22 9 23 49 5 48 2...
output:
6358889
result:
ok 1 number(s): "6358889"
Test #38:
score: 0
Accepted
time: 22ms
memory: 4016kb
input:
5000 2 14 32 27 5 4 23 3 49 48 30 11 34 16 36 42 31 29 26 19 14 17 44 7 25 37 39 32 47 21 8 26 38 21 48 7 11 32 39 3 1 37 49 18 42 22 14 26 46 19 50 29 40 44 6 25 33 30 49 18 11 7 49 27 47 31 33 8 46 20 1 6 10 45 42 35 2 24 43 37 41 16 39 32 17 19 36 40 4 15 48 13 34 25 3 38 26 30 28 29 12 21 9 50 2...
output:
6379184
result:
ok 1 number(s): "6379184"
Test #39:
score: 0
Accepted
time: 21ms
memory: 4176kb
input:
5000 38 11 34 37 2 1 13 12 39 36 18 47 8 48 32 23 6 17 43 7 21 19 33 20 5 9 28 38 49 27 31 15 50 40 14 26 24 42 45 1 24 36 50 18 17 29 35 7 42 36 47 14 25 41 4 8 19 46 44 9 34 23 31 28 39 1 13 45 15 26 37 21 49 40 12 10 6 24 36 4 10 28 5 14 46 9 24 34 11 31 35 25 29 26 3 12 45 18 17 49 23 40 37 22 4...
output:
6447730
result:
ok 1 number(s): "6447730"
Test #40:
score: 0
Accepted
time: 21ms
memory: 4020kb
input:
5000 38 6 47 17 25 24 15 23 10 3 14 16 48 2 40 31 12 13 41 27 7 28 19 37 44 8 21 49 36 26 34 30 4 38 42 45 33 20 1 32 29 36 24 6 18 42 28 23 32 39 2 41 9 50 7 19 37 10 27 31 26 15 5 44 30 46 43 45 49 16 40 48 23 1 7 36 2 48 6 47 43 45 30 8 17 27 33 15 37 4 18 50 34 49 10 16 9 9 22 18 12 24 34 16 21 ...
output:
6396988
result:
ok 1 number(s): "6396988"
Test #41:
score: 0
Accepted
time: 21ms
memory: 3944kb
input:
5000 19 28 2 37 23 18 39 30 38 16 40 33 31 12 8 21 43 48 41 42 33 35 45 16 5 14 44 9 36 28 17 32 22 48 49 1 30 20 26 19 27 3 2 15 47 18 37 43 8 34 12 7 21 6 12 45 11 34 8 6 39 27 49 24 29 42 33 40 24 39 7 50 21 26 28 6 49 12 42 37 15 19 32 33 23 11 20 45 47 31 13 38 40 22 29 30 4 9 41 46 17 10 8 18 ...
output:
6365283
result:
ok 1 number(s): "6365283"
Test #42:
score: 0
Accepted
time: 22ms
memory: 4256kb
input:
5000 28 3 42 49 19 32 44 46 29 23 15 24 18 41 13 27 5 33 39 31 7 10 28 45 36 12 9 37 14 17 7 46 24 35 15 38 20 22 30 18 14 39 16 8 28 36 2 20 8 49 36 1 40 23 32 31 37 41 20 39 45 12 9 11 10 3 27 13 33 23 41 19 28 14 25 47 34 42 4 44 1 38 27 35 48 30 6 17 18 33 49 22 20 15 50 12 45 21 37 26 5 46 39 5...
output:
6369107
result:
ok 1 number(s): "6369107"
Test #43:
score: 0
Accepted
time: 21ms
memory: 3896kb
input:
5000 34 20 11 31 40 36 37 9 30 34 15 8 44 28 24 2 49 45 46 38 21 42 39 4 16 50 35 1 26 22 23 33 43 6 12 39 22 50 35 33 31 36 16 42 39 3 28 44 30 4 26 10 5 12 24 47 7 11 19 8 1 29 46 18 34 27 25 20 41 37 48 9 21 49 15 29 27 49 15 12 22 39 20 29 4 16 35 45 25 8 34 37 3 19 33 30 32 48 14 41 42 2 38 5 6...
output:
6361262
result:
ok 1 number(s): "6361262"
Test #44:
score: 0
Accepted
time: 21ms
memory: 4184kb
input:
5000 11 3 22 23 46 19 43 41 26 11 1 18 28 16 45 48 34 26 28 14 38 20 27 29 13 7 37 18 23 50 2 9 42 35 49 39 40 1 8 24 47 12 13 14 24 12 16 38 35 10 47 23 27 9 47 45 15 36 18 9 43 6 37 42 33 20 31 21 1 10 12 8 16 4 32 2 14 47 11 3 17 24 30 49 38 40 23 46 13 19 25 50 48 35 28 27 7 34 41 26 39 5 8 34 2...
output:
6368932
result:
ok 1 number(s): "6368932"
Test #45:
score: 0
Accepted
time: 21ms
memory: 4212kb
input:
5000 39 23 14 3 27 47 35 28 6 18 10 48 46 13 39 21 40 11 19 29 17 42 5 2 38 33 45 34 32 41 49 31 43 20 25 8 50 26 16 36 12 3 43 21 5 18 2 4 11 17 31 25 12 27 6 5 49 48 8 44 7 28 35 41 43 46 18 32 3 16 20 19 27 13 14 40 37 34 26 42 29 25 49 9 34 3 18 46 21 13 40 39 10 50 23 41 42 22 2 25 14 6 43 5 38...
output:
6337628
result:
ok 1 number(s): "6337628"
Test #46:
score: 0
Accepted
time: 18ms
memory: 4252kb
input:
5000 28 20 1 21 49 15 41 26 7 11 19 36 5 6 28 39 48 18 31 46 10 2 38 40 17 42 9 32 37 5 10 40 29 2 30 35 49 2 34 6 47 50 25 20 1 38 44 21 30 19 35 9 14 27 12 48 13 23 39 7 18 5 28 3 43 24 40 22 42 32 46 25 5 28 40 48 47 9 30 12 2 49 17 8 46 20 3 34 6 4 10 7 19 22 39 16 31 42 16 14 47 32 11 49 8 36 4...
output:
6382248
result:
ok 1 number(s): "6382248"
Test #47:
score: 0
Accepted
time: 21ms
memory: 3952kb
input:
5000 34 39 24 29 45 33 34 18 48 40 42 3 35 46 2 26 31 1 37 38 32 6 8 47 9 50 30 12 22 25 20 43 44 4 41 3 31 47 36 33 27 30 29 19 18 47 8 9 12 43 44 14 16 35 20 17 38 10 34 39 21 48 4 5 31 45 33 42 22 3 25 11 24 12 33 9 27 32 25 15 38 6 46 36 26 50 5 10 48 37 5 42 6 14 5 30 32 11 13 50 43 1 18 32 8 4...
output:
6395773
result:
ok 1 number(s): "6395773"
Test #48:
score: 0
Accepted
time: 22ms
memory: 4008kb
input:
5000 6 48 27 19 45 11 43 1 39 42 38 30 33 32 50 31 48 8 3 17 18 29 27 4 39 1 11 22 34 49 41 46 23 13 35 15 42 5 7 47 20 2 14 21 36 37 6 28 16 25 24 43 48 45 16 24 35 44 6 36 31 33 11 47 3 18 32 5 48 14 27 1 42 49 50 8 26 22 12 9 15 21 46 23 38 30 29 40 20 34 39 41 25 43 28 17 10 13 4 2 19 18 8 43 42...
output:
6380527
result:
ok 1 number(s): "6380527"
Test #49:
score: 0
Accepted
time: 21ms
memory: 3956kb
input:
5000 17 9 28 18 44 45 39 20 12 33 43 22 31 38 36 2 23 48 10 2 19 34 1 33 12 8 36 47 39 31 50 33 24 40 2 44 29 6 27 21 16 9 10 11 41 31 12 37 14 38 23 3 45 35 7 22 46 1 13 43 39 22 42 34 16 43 37 22 13 15 27 1 33 5 48 30 17 36 50 14 49 3 20 19 5 28 23 41 2 46 24 9 3 34 10 29 17 28 42 7 6 33 16 18 5 2...
output:
6370895
result:
ok 1 number(s): "6370895"
Test #50:
score: 0
Accepted
time: 21ms
memory: 4008kb
input:
5000 19 24 18 5 11 16 36 46 20 27 25 34 10 41 39 1 32 35 6 42 33 31 34 6 44 35 49 17 42 28 38 25 30 16 5 29 39 18 7 2 43 12 37 33 47 15 32 50 24 19 10 8 46 11 31 18 25 29 49 21 1 5 10 33 36 45 3 46 50 2 9 47 40 43 42 34 31 32 15 8 39 28 6 14 27 12 15 21 8 9 1 28 43 10 13 44 27 39 30 24 36 25 38 20 3...
output:
6405029
result:
ok 1 number(s): "6405029"
Test #51:
score: 0
Accepted
time: 22ms
memory: 3900kb
input:
5000 8 39 25 47 33 41 15 29 50 43 19 7 21 16 38 3 50 8 33 13 27 5 49 47 9 29 17 14 41 48 45 37 44 4 36 35 22 39 12 28 23 42 6 2 15 20 26 46 31 34 30 24 40 28 15 39 6 31 32 24 37 42 4 28 18 38 45 17 33 29 12 3 21 35 9 20 46 14 11 34 5 49 45 4 38 22 13 36 41 27 40 39 24 16 34 15 10 5 37 14 26 17 43 1 ...
output:
6354985
result:
ok 1 number(s): "6354985"
Test #52:
score: 0
Accepted
time: 21ms
memory: 4176kb
input:
5000 5 34 18 22 8 17 17 46 12 37 45 38 2 9 29 42 13 20 26 48 30 14 27 8 15 16 35 45 7 27 1 33 23 5 32 9 21 19 47 36 4 50 26 8 32 23 25 34 33 7 48 49 37 31 6 28 43 9 17 24 47 46 38 26 44 21 16 35 27 23 35 24 28 49 10 8 21 18 19 12 16 44 13 34 23 39 31 37 32 25 22 40 17 44 20 14 34 1 9 46 18 19 32 17 ...
output:
6341842
result:
ok 1 number(s): "6341842"
Test #53:
score: 0
Accepted
time: 22ms
memory: 3956kb
input:
5000 19 19 31 2 5 26 9 14 24 37 22 38 41 20 17 23 34 11 40 6 23 43 4 15 48 47 17 20 30 6 38 36 31 23 34 10 29 37 32 8 26 44 22 41 40 45 43 2 28 35 41 7 18 10 31 20 49 5 40 50 15 22 26 33 16 34 30 42 48 8 32 36 3 19 6 17 29 23 12 39 21 47 4 1 9 8 23 19 40 2 37 13 36 41 7 23 47 21 14 13 25 2 11 37 50 ...
output:
6298180
result:
ok 1 number(s): "6298180"
Test #54:
score: 0
Accepted
time: 21ms
memory: 3948kb
input:
5000 45 44 9 20 46 22 7 6 3 30 27 32 31 49 36 8 43 33 47 13 17 19 50 14 41 35 25 39 12 42 48 10 11 5 15 18 38 23 34 28 45 16 29 26 2 21 49 9 38 13 49 36 42 14 35 7 39 50 48 21 46 47 15 34 2 27 22 41 3 43 1 11 28 30 16 25 18 10 40 5 26 44 24 33 20 19 31 8 4 6 12 17 23 32 45 37 6 34 1 32 14 36 22 3 23...
output:
6377186
result:
ok 1 number(s): "6377186"
Test #55:
score: 0
Accepted
time: 21ms
memory: 4012kb
input:
5000 28 10 15 24 13 43 8 28 42 44 11 34 9 25 48 36 1 38 41 33 40 17 49 45 46 5 21 29 6 15 14 28 2 37 23 43 9 32 35 21 29 18 3 36 44 38 19 5 25 39 33 48 43 32 35 21 46 3 10 27 17 4 28 40 50 34 31 18 30 13 15 36 8 23 20 14 29 24 1 41 12 11 38 49 27 39 3 18 34 37 40 23 21 6 9 8 36 14 20 4 10 32 25 15 2...
output:
6383844
result:
ok 1 number(s): "6383844"
Test #56:
score: 0
Accepted
time: 21ms
memory: 4020kb
input:
5000 49 3 39 41 28 38 22 30 21 10 31 40 25 49 27 16 7 20 1 13 14 36 8 23 4 17 5 32 50 9 29 35 34 47 46 12 43 37 48 26 15 19 44 33 2 18 11 45 24 6 41 17 4 33 19 24 15 40 2 45 27 14 31 46 39 16 9 3 41 26 11 42 8 18 5 22 36 49 25 35 47 23 48 13 7 38 28 43 10 30 29 44 40 36 31 5 15 26 14 50 32 34 48 18 ...
output:
6377722
result:
ok 1 number(s): "6377722"
Test #57:
score: 0
Accepted
time: 21ms
memory: 3956kb
input:
5000 15 11 39 37 44 5 18 23 34 33 3 12 38 47 24 29 5 18 43 31 32 8 15 23 42 20 14 38 8 19 36 15 50 10 3 47 40 5 19 47 28 21 38 13 42 12 11 32 44 3 27 5 14 26 20 7 34 39 15 19 10 2 23 15 42 38 43 18 34 16 24 28 49 44 32 20 37 36 25 35 9 13 39 50 31 18 16 4 28 30 15 38 19 1 46 47 34 33 26 48 42 5 44 2...
output:
6356478
result:
ok 1 number(s): "6356478"
Test #58:
score: 0
Accepted
time: 18ms
memory: 4008kb
input:
5000 25 37 12 50 11 42 10 2 48 29 25 7 15 20 34 33 39 16 1 13 36 4 40 43 14 3 14 31 44 46 11 8 43 2 10 18 34 50 14 24 22 1 33 10 26 7 40 41 32 36 23 27 45 1 3 25 7 8 13 19 21 10 42 50 3 27 9 30 25 37 28 35 27 17 50 15 14 47 38 24 31 23 45 9 37 49 22 7 12 36 13 11 35 8 20 19 48 33 29 27 43 47 50 19 2...
output:
6355823
result:
ok 1 number(s): "6355823"
Test #59:
score: 0
Accepted
time: 21ms
memory: 4252kb
input:
5000 34 15 20 44 24 38 34 12 14 49 32 8 37 3 36 40 22 5 4 29 41 9 28 27 48 1 18 45 30 43 11 21 16 6 46 8 49 13 42 19 26 8 14 7 41 33 18 7 25 36 29 32 9 1 6 17 48 24 35 50 31 14 2 42 43 23 11 28 44 20 37 46 39 21 15 40 26 47 4 19 38 30 12 45 8 49 8 40 16 44 32 9 39 7 19 41 19 46 4 21 43 20 9 42 12 38...
output:
6371501
result:
ok 1 number(s): "6371501"
Test #60:
score: 0
Accepted
time: 18ms
memory: 3964kb
input:
5000 13 34 31 48 47 5 33 20 12 17 38 21 8 45 29 11 2 40 29 30 34 32 46 45 20 43 15 23 28 37 35 26 7 50 6 41 36 21 9 5 17 38 42 25 34 21 17 16 47 23 5 31 2 32 10 39 4 28 44 9 11 6 33 49 35 34 46 45 8 20 18 38 37 1 30 13 22 43 3 40 32 9 13 18 24 11 46 25 8 39 49 31 28 20 29 23 14 12 35 42 5 15 27 34 6...
output:
6363314
result:
ok 1 number(s): "6363314"
Test #61:
score: 0
Accepted
time: 21ms
memory: 4012kb
input:
5000 30 5 34 12 3 43 44 15 32 2 38 46 50 41 30 37 23 42 16 26 19 28 47 8 48 1 11 14 25 22 49 29 26 22 45 40 4 18 43 19 27 15 21 13 39 6 47 32 41 12 33 24 3 8 7 49 16 35 5 1 29 46 18 21 10 27 25 32 35 30 31 23 13 19 28 40 41 22 4 7 47 37 33 49 43 39 9 45 6 5 8 29 14 12 2 24 50 20 1 38 48 36 34 15 11 ...
output:
6456565
result:
ok 1 number(s): "6456565"
Test #62:
score: 0
Accepted
time: 21ms
memory: 3956kb
input:
5000 36 47 31 20 50 12 43 44 8 45 39 9 23 22 15 34 5 19 25 41 48 27 11 49 14 46 10 35 38 21 17 42 13 2 26 18 36 40 21 26 41 40 42 37 30 36 5 29 47 6 49 25 35 27 39 13 34 4 45 19 10 17 11 15 3 20 16 24 22 2 18 46 12 32 48 43 28 23 46 16 3 42 50 38 7 20 46 34 15 18 28 11 24 47 45 9 32 21 35 26 39 27 3...
output:
6374048
result:
ok 1 number(s): "6374048"
Test #63:
score: 0
Accepted
time: 21ms
memory: 4008kb
input:
5000 21 39 24 22 48 30 49 2 37 1 26 38 46 14 29 7 11 43 28 34 40 44 1 27 13 29 5 27 37 50 21 36 47 1 9 34 30 17 49 42 25 20 35 10 24 16 22 49 26 40 18 46 6 23 30 7 41 27 4 21 2 33 36 37 17 48 8 34 45 15 31 1 19 44 13 9 43 11 47 29 3 5 39 28 32 14 50 38 50 30 31 19 21 43 26 5 3 41 8 13 46 29 24 48 7 ...
output:
6403716
result:
ok 1 number(s): "6403716"
Test #64:
score: 0
Accepted
time: 21ms
memory: 4212kb
input:
5000 40 8 40 30 1 33 37 19 15 4 45 26 44 28 21 23 12 31 16 13 49 48 47 24 43 32 7 50 20 25 17 18 10 6 22 39 11 2 9 27 3 48 11 4 27 14 41 34 21 8 18 29 13 1 24 40 15 3 12 20 25 45 42 7 49 30 16 39 32 23 36 50 22 38 35 2 37 33 44 48 47 10 26 5 31 28 46 19 17 9 5 40 44 46 14 13 41 9 22 42 46 28 13 44 1...
output:
6321495
result:
ok 1 number(s): "6321495"