QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#83850#3799. It's Surely ComplexRiceShower#AC ✓1226ms204848kbC++2014.1kb2023-03-03 17:27:252023-03-03 17:27:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-03 17:27:29]
  • 评测
  • 测评结果:AC
  • 用时:1226ms
  • 内存:204848kb
  • [2023-03-03 17:27:25]
  • 提交

answer

// 从未在意的名字永远不会被提起 - 雪葉/鹤见江野

/*
+
++
+++
++++
+++++
++++++
+++++++
++++++++
+++++++++
++++++++++
+++++++++++
++++++++++++
+++++++++++++
++++++++++++++
+++++++++++++++
++++++++++++++++
+++++++++++++++++
++++++++++++++++++
+ +++++++++++++++++
+  ++++++++++++++ ++
+   +++++++++++++  ++
+    ++++++++++++   ++
+     +++++++++++    ++
+      ++++++++++     ++
+       +++++++++      ++
+        ++++++++       ++
+         +++++++++++++++++
+          +++++++++++++++++
+           ++++++++++++++
+            +++++++++++
+             ++++++++
+              +++++
+               ++
+               +
+               +
+              ++
+             +++
+            ++++
+           +++++
+           +++++
+           +++++
+           +++++
+     +     +++++
+    +++    +++++
+   ++ ++   +++++
+  ++   ++  +++++
+ ++  +  ++ +++++
+++  +++  +++++++
++  ++ ++  ++++++
 
 
 ++++++++      +++++++++++     +++      +++        ++++++++        ++++++++
+++++++++     +++++++++++++    +++      +++       +++    +++      +++    +++
+++          +++   +++   +++   +++      +++      +++   ++++++    +++      +++
+++          +++   +++   +++   +++      +++      +++ +++  +++           +++
+++          +++   +++   +++   +++ ++   +++ ++   ++++++   +++         +++
+++++++++    +++   +++   +++   +++ ++   +++ ++    +++    +++        +++    ++
 ++++++++    +++   +++   +++   +++++    +++++      ++++++++       +++++++++++
*/
#ifndef ONLINE_JUDGE
#define DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <assert.h>
#include <math.h>
#include <set>
#define nln puts("")
#define od(x) printf("%d",x)
#define odb(x) printf("%d ",x)
#define odl(x) printf("%d\n",x)
#define odp(x,y) printf("%d %d\n",x,y)
#define ol(x) puts("")
#define old(x) printf("%lld",x)
#define oldb(x) printf("%lld ",x)
#define oldl(x) printf("%lld\n",x)
#define oldp(x,y) printf("%lld %lld\n",x,y)
#define rg(x) for(int i=1;i<=(x);i++){
#define rg_(i,x) for(int i=1;i<=(x);i++){
#define fe(u) for(int i=h[u];i;i=e[i].nxt){int v=e[i].v;
#define gr }
#define rrg(x) for(int i=0;i<(x);i++){
#define rdln(a) a[i]=read();
#define rdln0(a,x) rrg(x) rdln(a) gr
#define rdln1(a,x) rg(x) rdln(a) gr
template<typename T>
void print(T x){}
template<>
void print<int>(int x){od(x);}
template<>
void print<const int>(const int x){od(x);}
template<>
void print<long long>(long long x){old(x);}
template<>
void print<const long long>(const long long x){old(x);}
template<>
void print<char>(char x){putchar(x);}
template<>
void print<const char>(const char x){putchar(x);}
template<>
void print<double>(double x){printf("%.12lf",x);}
template<typename T,typename... qwq>
void print(T x,qwq ...args)
{
	print(x);
	print(args...);
}
#ifdef DEBUG
template<typename T>
void debug(T x){}
template<>
void debug<int>(int x){od(x);}
template<>
void debug<const int>(const int x){od(x);}
template<>
void debug<long long>(long long x){old(x);}
template<>
void debug<const long long>(const long long x){old(x);}
template<>
void debug<char>(char x){putchar(x);}
template<>
void debug<const char>(const char x){putchar(x);}
template<>
void debug<double>(double x){printf("%.12lf",x);}
template<typename T,typename... qwq>
void debug(T x,qwq ...args)
{
	debug(x);
	debug(args...);
}
#define dflush fflush
#else
#define dflush(...) 0
template<typename T,typename... qwq>
void debug(T x,qwq ...args)
{
	
}
#endif

#define int long long
int mod=998244353;
#ifdef int 
#define inf 0x3f3f3f3f3f3f3f3fll
#else 
#define inf 0x3f3f3f3f
#endif
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
#define cmlSEGMIN
#define cmlSEGMAX
#define cmlSEGSUM
class SegTreeAl{
#ifdef cmlSEGMIN
	int minn[1000005<<2];
#endif
#ifdef cmlSEGMAX
	int maxn[1000005<<2];
#endif
#ifdef cmlSEGSUM
	int sum[1000005<<2];
#endif
	int tag[1000005<<2];
#ifdef cmlSEGSUM
	void pushdown(int o,int l,int r)
#else 
	void pushdown(int o)
#endif
	{
		int&t=tag[o];
#ifdef cmlSEGMIN
		minn[o<<1]+=t;
		minn[o<<1|1]+=t;
#endif
#ifdef cmlSEGMAX
		maxn[o<<1]+=t;
		maxn[o<<1|1]+=t;
#endif
#ifdef cmlSEGSUM
		int m=l+r>>1;
		sum[o<<1]+=t*(m-l+1);
		sum[o<<1|1]+=t*(r-m);
#endif
		tag[o<<1]+=t;
		tag[o<<1|1]+=t;
		t=0;
	}
	void add(int o,int l,int r,int L,int R,int v)
	{
		if(L<=l&&r<=R)
		{
#ifdef cmlSEGMAX
			maxn[o]+=v;
#endif
#ifdef cmlSEGMIN
			minn[o]+=v;
#endif
#ifdef cmlSEGSUM
			sum[o]+=v*(r-l+1);
#endif
			tag[o]+=v;
			return;
		}
		int m=l+r>>1;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)add(o<<1,l,m,L,R,v);
		if(m<R)add(o<<1|1,m+1,r,L,R,v);
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
	}
#ifdef cmlSEGMIN
	int qmin(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return minn[o];
		}
		int m=l+r>>1,res=inf;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res=min(res,qmin(o<<1,l,m,L,R));
		if(m<R)res=min(res,qmin(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif

#ifdef cmlSEGMAX
	int qmax(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return maxn[o];
		}
		int m=l+r>>1,res=-inf;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res=max(res,qmax(o<<1,l,m,L,R));
		if(m<R)res=max(res,qmax(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif

#ifdef cmlSEGSUM
	int qsum(int o,int l,int r,int L,int R)
	{
		if(L<=l&&r<=R)
		{
			return sum[o];
		}
		int m=l+r>>1,res=0;
#ifdef cmlSEGSUM
		pushdown(o,l,r);
#else
		pushdown(o);
#endif
		if(L<=m)res+=qsum(o<<1,l,m,L,R);
		if(m<R)res+=qsum(o<<1|1,m+1,r,L,R);
#ifdef cmlSEGMAX
		maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
		minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
		sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
		return res;
	}
#endif
};
#define newe(n) struct Edge{int v,w,nxt;}e[2*n+5];\
typedef int arr[n+5];\
arr h;\
int cnt=1;\
inline void addedge(int u,int v,int w){e[cnt]=(Edge){v,w,h[u]};h[u]=cnt++;}\
struct node{\
	int u,d;\
	bool operator<(const node&b)const{return d>b.d;}\
};\
void dij(int s,int *d,int N)\
{\
	memset(d,0x3f,sizeof(int)*(N+3));\
	d[s]=0;std::priority_queue<node>q;q.push((node){s,0});\
	while(!q.empty())\
	{\
		int u=q.top().u,D=q.top().d;q.pop();if(D!=d[u])continue;\
		for(int i=h[u];i;i=e[i].nxt){int v=e[i].v,w=e[i].w;\
		if(d[u]+w<d[v])d[v]=d[u]+w,q.push((node){v,d[v]});\
		}\
	}\
}
#define mgs int fa[1<<22],sz[1<<22];\
inline int f(int x){return x==fa[x]?x:fa[x]=f(fa[x]);}\
inline int uf(int x,int y)\
{\
    int fx=f(x),fy=f(y);\
    if(fx==fy)return 0;\
    if(sz[fx]>sz[fy])fx^=fy^=fx^=fy;\
    fa[fx]=fy,sz[fy]+=sz[fx];\
    return 1;\
}
inline int read()
{
    int num=0,f=1;char c=getchar();
    while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
    while(c>47&&c<58)num=num*10+(c^48),c=getchar();
    return num*f;
}
inline int re1d()
{
    char c=getchar();
    while(c<48||c>49)c=getchar();
    return c&1;
}
#ifdef cmlBIT
struct BIT{int a[1<<20|1],n;
void add(int x,int p){while(x<=n)a[x]+=p,x+=x&-x;}
int operator[](int x){int res=0;while(x)res+=a[x],x-=x&-x;return res;}
int operator()(int l,int r){return (*this)[r]-(*this)[l-1];}};
#endif
int rnv[1000005];
#define COMB
#ifdef COMB
#ifndef int
#define int long long
#endif
int fac[1000005],inv[1000005];
#endif
void initprog()
{
#ifdef COMB
	fac[0]=inv[0]=inv[1]=1;
	rg(1000000)fac[i]=fac[i-1]*i%mod;gr
	rg(1000000)if(i>1)inv[i]=inv[mod%i]*(mod-mod/i)%mod;gr
	rg(1000000)rnv[i]=inv[i];gr
	rg(1000000)inv[i]=inv[i]*inv[i-1]%mod;gr
#endif
}
#ifdef COMB
int C(int n,int m)
{
	if(n==m||m==0)return 1;
	if(n<m)return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
#endif
inline int qp(int a,int b){int c=1;while(b){if(b&1)c=c*a%mod;a=a*a%mod;b>>=1;}return c;}
inline int mae(int &a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int mde(int &a,int b){a+=mod-b;if(a>=mod)a-=mod;return a;}
inline int mle(int &a,int b){a=a*b%mod;return a;}
inline int mve(int &a,int b){a=a*qp(b,mod-2)%mod;return a;}
inline int mxe(int &a,int b){return a=a>b?a:b;}
inline int mne(int &a,int b){return a=a<b?a:b;}
inline int ae(int a,int b){int c=a+b;return c>=mod?c-mod:c;}
inline int de(int a,int b){return ae(a,mod-b);}
inline int me(int a,int b){return a*b%mod;}
inline int mive(int &a,int b){a=a*rnv[b]%mod;return a;}
inline int ive(int a,int b){return a*rnv[b]%mod;}
inline int ve(int a,int b){return a*qp(b,mod-2)%mod;}
#ifdef cmlST
struct STmin{
	int a[21][1000005],n;
	void init(int N,int *b)
	{
		n=N;
		rg(n)a[0][i]=b[i];gr
		rg(20)rg_(j,n-(1<<i)+1)a[i][j]=min(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
	}
	int q(int l,int r)
	{
		int d=std::__lg(r-l+1);
		return min(a[d][l],a[d][r-(1<<d)+1]);
	}
};
struct STmax{
	int a[21][1000005],n;
	void init(int N,int *b)
	{
		n=N;
		rg(n)a[0][i]=b[i];gr
		rg(20)rg_(j,n-(1<<i)+1)a[i][j]=max(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
	}
	int q(int l,int r)
	{
		int d=std::__lg(r-l+1);
		return max(a[d][l],a[d][r-(1<<d)+1]);
	}
};
#endif
#ifdef cmlSAM
struct SAM{
	int ch[1000005][26],lnk[1000005],len[1000005],lst=1,cc=1;
	int sz[1000005];
	void insert(int c)
	{
		len[++cc]=len[lst]+1;sz[cc]=1;
		int p=lst;lst=cc;
		while(p&&ch[p][c]==0)ch[p][c]=cc,p=lnk[p];
		if(p==0)lnk[cc]=1;
		else
		{
			int x=ch[p][c];
			if(len[p]+1==len[x])lnk[cc]=x;
			else
			{
				int q=cc;++cc;
				lnk[cc]=lnk[x];
				lnk[x]=lnk[q]=cc;
				len[cc]=len[p]+1;
				memcpy(ch[cc],ch[x],sizeof(ch[cc]));
				while(p&&ch[p][c]==x)ch[p][c]=cc,p=lnk[p];
			}
		}
	}
	newe(1000005);
	long long ans;
	void build()
	{
		rg(cc)addedge(lnk[i],i,0);gr
	}
	void dfs(int u)
	{
		fe(u)dfs(v),sz[u]+=sz[v];gr
		if(sz[u]>1)ans=max(ans,1ll*sz[u]*len[u]);
	}
}t;
#endif
using std::swap;
struct complex{
	int a,b;
	complex operator*(complex c){
		return {de(me(a,c.a),me(b,c.b)),(a*c.b+b*c.a)%mod};
	}
};
complex qp(complex a,int b)
{
	complex res={1,0},x=a;
	while(b)
	{
		if(b&1)res=res*x;x=x*x;b>>=1;
	}
	return res;
}
int p;struct zhanghengyi
{
const long double pi=acos(-1);
struct cp
{
    long double r,i;
    cp operator+(const cp &x)const{return (cp){x.r+r,x.i+i};}
    cp operator-(const cp &x)const{return (cp){r-x.r,i-x.i};}
    cp operator*(const cp &x)const{return (cp){r*x.r-i*x.i,r*x.i+i*x.r};}
}A[1<<20],B[1<<20],C[1<<20],D[1<<20],E[1<<20];
int rev[1<<20],N=1;
void init()
{
    int d=N>>1;
    rev[0]=0,rev[1]=N>>1;
    for(int i=2; i<N; i<<=1)
    {
        d>>=1;
        for(int j=0; j<i; ++j) rev[i+j]=rev[j]|d;
    }
    return ;
}
void FFT(cp* F,int op)
{
    for(int i=0; i<N; ++i) if(rev[i]>i) swap(F[i],F[rev[i]]);
    for(int len=2,M=1; len<=N; len<<=1,M<<=1)
    {
        cp w=(cp){cos(pi/M*op),sin(pi/M*op)};
        //omega(m,1)
        for(int l=0,r=len-1; l<N; l+=len,r+=len)
        {
            cp w0=(cp){1,0};
            for(int i=l; i<l+M; ++i)
            {
                cp x=F[i],y=w0*F[i+M];
                F[i]=x+y,F[i+M]=x-y,w0=w0*w;
            }
        }
    }
}
int qp(int x,long long y,int p)
{
	int res=1;
	for(int t=x; y; y>>=1,t=1ll*t*t%p)
		if(y&1) res=1ll*res*t%p;
	return res;
}
long long ans[1<<20];
int a[1<<20];
signed main(int n,int m)
{
	// int R=1;
	// for(int i=0; i<=m; ++i)
		// for(int j=i+1; j<=m; ++j)
			// R=(1ll*i*i+1ll*j*j)%n*R%n;
	// return R;
    for(;N<=n+n;N<<=1);
    for(int i=0; i<=m; ++i) ++a[1ll*i*i%n];
    for(int i=0,x; i<n; ++i)
    	// printf("%d ",a[i]),
    	x=a[i],A[i].r=x&32767,B[i].r=x>>15;
    for(int i=0,x; i<n; ++i)
    	x=a[i],C[i].r=x&32767,D[i].r=x>>15;
    init();
    FFT(A,1),FFT(B,1),FFT(C,1),FFT(D,1);
    for(int i=0; i<N; ++i)
    	E[i]=A[i]*D[i]+B[i]*C[i],
    	A[i]=A[i]*C[i],B[i]=B[i]*D[i];
    FFT(A,-1),FFT(B,-1),FFT(E,-1);
    // puts("");
    for(int i=0; i<=n+n; ++i) 
    {
        long long ans1=(A[i].r/N+0.5),
        ans2=(E[i].r/N+0.5),ans3=(B[i].r/N+0.5);
        ans2<<=15,ans3<<=30;
        // printf("%lld ",ans1+ans2+ans3);
        ans[i%n]+=(ans1+ans2+ans3);
    }
    // puts("");
    for(int i=0; i<=m; ++i)
    	--ans[2ll*i*i%n];
    int res=1;
    for(int i=0; i<n; ++i)
    {
    	if(ans[i]&1) puts("ERR");
    	ans[i]>>=1;
    	res=1ll*res*qp(i,ans[i],n)%n;
    }
    return res;
}
}T;
signed main()
{
	p=mod=read();
	int n=read();
	initprog();
	complex r={1,0};
	int o=n/mod;
	// for(int i=0;i<79;i++)
		// for(int j=!i;j<79;j++)
			// r=r*(complex){i,j};
	// odp(r.a,r.b);
	// return 0;
	if(o>=1)
	{
		// if(mod%4!=3)return odp(0,0),0;
		complex shi={1,0},xu={1,0},F={fac[mod-1],0};
		rrg(mod)shi=shi*(complex){1,i};gr
		rrg(mod)xu=xu*(complex){i,1};gr
		complex di={1,0};
		rg(mod-1)di=di*(complex){0,i};gr
		complex all=qp(shi,mod-1)*di*F;
		int len=n%mod;
		complex a=qp(shi,len)*(complex){fac[len],0}*di;
		// odp(a.a,a.b);
		complex b=qp(xu,len)*(complex){fac[len],0}*F;
		r=qp(qp(all,o),o)*qp(a,o)*qp(b,o);
		
		// int wz=fac[mod-1]*qp(2,mod-1)%mod;
		// complex tmp={wz,0},oh={1,0};
		// rg(mod-1)oh=oh*(complex){0,i};gr
		// tmp=tmp*oh;
		// r=qp(tmp,(o%(mod-1)*o)%(mod-1));
// 		
		// complex L={2,0};L=qp(L,n%mod);
		// L=L*(complex){fac[n%mod],0}*oh;
// 		
		// complex shit={1,0},shit2={1,0};
		// rrg(mod)shit2=shit2*(complex){i,1};gr
		// complex R=qp(shit2,n%mod);
		// L=L*R;
		// r=r*qp(L,o);
		// odp(r.a,r.b);
	}
	complex op{T.main(mod,n%mod),0};
	// odl(op.a);
	int s=n%mod;
	op=op*qp((complex){0,1},s*s+s+1>>1);;
	r=r*op;
	rg(n%mod)r=r*(complex){i,i};gr
	// odl(p);
	// odl(fac[mod-1]%mod);
	// complex r={1,0};
	// rrg(mod)r=r*(complex){n%mod,i};gr
	odp(r.a,r.b);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 49ms
memory: 24976kb

input:

2 1

output:

1 1

result:

ok single line: '1 1'

Test #2:

score: 0
Accepted
time: 53ms
memory: 24976kb

input:

2 2

output:

1 1

result:

ok single line: '1 1'

Test #3:

score: 0
Accepted
time: 50ms
memory: 24916kb

input:

2 3

output:

0 0

result:

ok single line: '0 0'

Test #4:

score: 0
Accepted
time: 51ms
memory: 24896kb

input:

2 4

output:

0 0

result:

ok single line: '0 0'

Test #5:

score: 0
Accepted
time: 38ms
memory: 24888kb

input:

3 1

output:

2 1

result:

ok single line: '2 1'

Test #6:

score: 0
Accepted
time: 45ms
memory: 24888kb

input:

3 2

output:

2 0

result:

ok single line: '2 0'

Test #7:

score: 0
Accepted
time: 57ms
memory: 24952kb

input:

3 3

output:

1 0

result:

ok single line: '1 0'

Test #8:

score: 0
Accepted
time: 51ms
memory: 24916kb

input:

3 4

output:

1 1

result:

ok single line: '1 1'

Test #9:

score: 0
Accepted
time: 46ms
memory: 24952kb

input:

3 5

output:

1 0

result:

ok single line: '1 0'

Test #10:

score: 0
Accepted
time: 50ms
memory: 24896kb

input:

3 6

output:

1 0

result:

ok single line: '1 0'

Test #11:

score: 0
Accepted
time: 46ms
memory: 24976kb

input:

5 1

output:

4 1

result:

ok single line: '4 1'

Test #12:

score: 0
Accepted
time: 36ms
memory: 24904kb

input:

5 2

output:

0 0

result:

ok single line: '0 0'

Test #13:

score: 0
Accepted
time: 60ms
memory: 24916kb

input:

5 3

output:

0 0

result:

ok single line: '0 0'

Test #14:

score: 0
Accepted
time: 54ms
memory: 24976kb

input:

5 4

output:

0 0

result:

ok single line: '0 0'

Test #15:

score: 0
Accepted
time: 47ms
memory: 24896kb

input:

5 5

output:

0 0

result:

ok single line: '0 0'

Test #16:

score: 0
Accepted
time: 55ms
memory: 24900kb

input:

5 6

output:

0 0

result:

ok single line: '0 0'

Test #17:

score: 0
Accepted
time: 62ms
memory: 24960kb

input:

5 7

output:

0 0

result:

ok single line: '0 0'

Test #18:

score: 0
Accepted
time: 62ms
memory: 24964kb

input:

5 8

output:

0 0

result:

ok single line: '0 0'

Test #19:

score: 0
Accepted
time: 61ms
memory: 24976kb

input:

5 9

output:

0 0

result:

ok single line: '0 0'

Test #20:

score: 0
Accepted
time: 39ms
memory: 24976kb

input:

5 10

output:

0 0

result:

ok single line: '0 0'

Test #21:

score: 0
Accepted
time: 45ms
memory: 24968kb

input:

7 1

output:

6 1

result:

ok single line: '6 1'

Test #22:

score: 0
Accepted
time: 49ms
memory: 24916kb

input:

7 2

output:

3 0

result:

ok single line: '3 0'

Test #23:

score: 0
Accepted
time: 37ms
memory: 24972kb

input:

7 3

output:

2 5

result:

ok single line: '2 5'

Test #24:

score: 0
Accepted
time: 55ms
memory: 24896kb

input:

7 4

output:

1 0

result:

ok single line: '1 0'

Test #25:

score: 0
Accepted
time: 38ms
memory: 24848kb

input:

7 5

output:

5 2

result:

ok single line: '5 2'

Test #26:

score: 0
Accepted
time: 50ms
memory: 24956kb

input:

7 6

output:

6 0

result:

ok single line: '6 0'

Test #27:

score: 0
Accepted
time: 48ms
memory: 24908kb

input:

7 7

output:

1 0

result:

ok single line: '1 0'

Test #28:

score: 0
Accepted
time: 54ms
memory: 24976kb

input:

7 8

output:

4 4

result:

ok single line: '4 4'

Test #29:

score: 0
Accepted
time: 54ms
memory: 24968kb

input:

7 9

output:

4 0

result:

ok single line: '4 0'

Test #30:

score: 0
Accepted
time: 57ms
memory: 24972kb

input:

7 10

output:

2 2

result:

ok single line: '2 2'

Test #31:

score: 0
Accepted
time: 54ms
memory: 24900kb

input:

7 11

output:

1 0

result:

ok single line: '1 0'

Test #32:

score: 0
Accepted
time: 61ms
memory: 24972kb

input:

7 12

output:

4 4

result:

ok single line: '4 4'

Test #33:

score: 0
Accepted
time: 42ms
memory: 24892kb

input:

7 13

output:

1 0

result:

ok single line: '1 0'

Test #34:

score: 0
Accepted
time: 44ms
memory: 24980kb

input:

7 14

output:

1 0

result:

ok single line: '1 0'

Test #35:

score: 0
Accepted
time: 55ms
memory: 24956kb

input:

2 1000000000000000000

output:

0 0

result:

ok single line: '0 0'

Test #36:

score: 0
Accepted
time: 54ms
memory: 25028kb

input:

3 1000000000000000000

output:

1 1

result:

ok single line: '1 1'

Test #37:

score: 0
Accepted
time: 1148ms
memory: 204672kb

input:

499979 1000000000000000000

output:

486292 0

result:

ok single line: '486292 0'

Test #38:

score: 0
Accepted
time: 1226ms
memory: 204848kb

input:

499973 1000000000000000000

output:

0 0

result:

ok single line: '0 0'

Test #39:

score: 0
Accepted
time: 47ms
memory: 25028kb

input:

2 576460752303423488

output:

0 0

result:

ok single line: '0 0'

Test #40:

score: 0
Accepted
time: 53ms
memory: 24968kb

input:

3 864691128455135232

output:

1 0

result:

ok single line: '1 0'

Test #41:

score: 0
Accepted
time: 58ms
memory: 24936kb

input:

43 41

output:

32 11

result:

ok single line: '32 11'

Test #42:

score: 0
Accepted
time: 48ms
memory: 25004kb

input:

89 646243632056227082

output:

0 0

result:

ok single line: '0 0'

Test #43:

score: 0
Accepted
time: 39ms
memory: 25004kb

input:

79 3818048575756175

output:

61 18

result:

ok single line: '61 18'

Test #44:

score: 0
Accepted
time: 53ms
memory: 24980kb

input:

43 417918461

output:

1 0

result:

ok single line: '1 0'

Test #45:

score: 0
Accepted
time: 47ms
memory: 24936kb

input:

67 9225777529942049

output:

26 0

result:

ok single line: '26 0'

Test #46:

score: 0
Accepted
time: 45ms
memory: 24980kb

input:

29 1894616718601

output:

0 0

result:

ok single line: '0 0'

Test #47:

score: 0
Accepted
time: 46ms
memory: 25020kb

input:

73 24891833259

output:

0 0

result:

ok single line: '0 0'

Test #48:

score: 0
Accepted
time: 48ms
memory: 25200kb

input:

751 45

output:

36 715

result:

ok single line: '36 715'

Test #49:

score: 0
Accepted
time: 51ms
memory: 25260kb

input:

631 870852734504724166

output:

101 0

result:

ok single line: '101 0'

Test #50:

score: 0
Accepted
time: 46ms
memory: 25064kb

input:

479 939006

output:

52 0

result:

ok single line: '52 0'

Test #51:

score: 0
Accepted
time: 51ms
memory: 25068kb

input:

503 223239772447

output:

381 0

result:

ok single line: '381 0'

Test #52:

score: 0
Accepted
time: 34ms
memory: 25072kb

input:

317 73782933513241136

output:

0 0

result:

ok single line: '0 0'

Test #53:

score: 0
Accepted
time: 46ms
memory: 25244kb

input:

577 4897864747011

output:

0 0

result:

ok single line: '0 0'

Test #54:

score: 0
Accepted
time: 45ms
memory: 25304kb

input:

571 7326187013

output:

400 171

result:

ok single line: '400 171'

Test #55:

score: 0
Accepted
time: 77ms
memory: 30424kb

input:

9787 39

output:

953 8834

result:

ok single line: '953 8834'

Test #56:

score: 0
Accepted
time: 58ms
memory: 27648kb

input:

4177 296229723194145403

output:

0 0

result:

ok single line: '0 0'

Test #57:

score: 0
Accepted
time: 57ms
memory: 27652kb

input:

5039 71501150263015946

output:

4425 4425

result:

ok single line: '4425 4425'

Test #58:

score: 0
Accepted
time: 69ms
memory: 27696kb

input:

7027 44142

output:

6075 0

result:

ok single line: '6075 0'

Test #59:

score: 0
Accepted
time: 48ms
memory: 25592kb

input:

1877 5605079

output:

0 0

result:

ok single line: '0 0'

Test #60:

score: 0
Accepted
time: 58ms
memory: 26228kb

input:

2251 187

output:

1847 404

result:

ok single line: '1847 404'

Test #61:

score: 0
Accepted
time: 52ms
memory: 26376kb

input:

3863 699

output:

3850 13

result:

ok single line: '3850 13'

Test #62:

score: 0
Accepted
time: 242ms
memory: 68736kb

input:

92557 64

output:

28440 0

result:

ok single line: '28440 0'

Test #63:

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

input:

62047 410196757795686372

output:

11479 11479

result:

ok single line: '11479 11479'

Test #64:

score: 0
Accepted
time: 288ms
memory: 69036kb

input:

67129 2833304630

output:

0 0

result:

ok single line: '0 0'

Test #65:

score: 0
Accepted
time: 302ms
memory: 69400kb

input:

90793 25188225487855

output:

0 0

result:

ok single line: '0 0'

Test #66:

score: 0
Accepted
time: 154ms
memory: 47396kb

input:

55313 111467

output:

0 0

result:

ok single line: '0 0'

Test #67:

score: 0
Accepted
time: 267ms
memory: 69004kb

input:

69151 718198020401

output:

9621 59530

result:

ok single line: '9621 59530'

Test #68:

score: 0
Accepted
time: 152ms
memory: 47172kb

input:

48571 56301

output:

2628 0

result:

ok single line: '2628 0'

Test #69:

score: 0
Accepted
time: 1027ms
memory: 199560kb

input:

326983 51

output:

39793 287190

result:

ok single line: '39793 287190'

Test #70:

score: 0
Accepted
time: 1173ms
memory: 203324kb

input:

406183 933021611983655873

output:

238788 167395

result:

ok single line: '238788 167395'

Test #71:

score: 0
Accepted
time: 586ms
memory: 113364kb

input:

152729 7971425537345

output:

0 0

result:

ok single line: '0 0'

Test #72:

score: 0
Accepted
time: 557ms
memory: 113776kb

input:

183047 6977

output:

141264 41783

result:

ok single line: '141264 41783'

Test #73:

score: 0
Accepted
time: 533ms
memory: 114148kb

input:

207973 3240

output:

0 0

result:

ok single line: '0 0'

Test #74:

score: 0
Accepted
time: 556ms
memory: 113188kb

input:

141907 10497585978

output:

141777 141777

result:

ok single line: '141777 141777'

Test #75:

score: 0
Accepted
time: 1073ms
memory: 201336kb

input:

279317 6562

output:

0 0

result:

ok single line: '0 0'