→ _ → OI late career began to brush the question we board
In fact, this problem is the formula for the title track, the students engaged in polynomial family bucket Veg board two shining under the formula code can too ...
As proof formula Well ... In short paste formula:
\[Arcsin(F)=\int{F'\over \sqrt{1-F^2}}\]
\[Arctan(F)=\int{F'\over 1+F^2}\]
Kang then be out here is a use Sqrt, Inv, Inter, Direv of ordinary Polynomial title
Code
//by Judge
#include<bits/stdc++.h>
#define Rg register
#define fp(i,a,b) for(Rg int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(Rg int i=(a),I=(b)-1;i>I;--i)
#define ll long long
using namespace std;
const int mod=998244353;
const int iG=332748118;
const int M=3e5+3;
typedef int arr[M];
#ifndef Judge
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#endif
char buf[1<<21],*p1=buf,*p2=buf;
inline int dec(int x,int y){return (x-=y)<0?x+mod:x;}
inline int inc(int x,int y){return (x+=y)>=mod?x-mod:x;}
inline int mul(int x,int y){return 1ll*x*y%mod;}
inline int read(){ int x=0,f=1; char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
for(;isdigit(c);c=getchar()) x=x*10+c-'0'; return x*f;
} char sr[1<<21],z[20];int CCF=-1,Z;
inline void Ot(){fwrite(sr,1,CCF+1,stdout),CCF=-1;}
inline void print(int x,char chr=' '){
if(CCF>1<<20)Ot();if(x<0)sr[++CCF]=45,x=-x;
while(z[++Z]=x%10+48,x/=10);
while(sr[++CCF]=z[Z],--Z);sr[++CCF]=chr;
} int n,tp,d,limit; arr a,b,r[21],lg,inv,G[2];
inline int qpow(Rg int x,Rg int p=mod-2,Rg int s=1){
for(;p;p>>=1,x=mul(x,x)) if(p&1) s=mul(s,x); return s;
}
namespace Poly{
inline void init(Rg int n){ d=0;
for(limit=1;limit<=n<<1;limit<<=1)++d;
}
inline void prep(int n){ inv[1]=1,init(n);
fp(i,2,limit) inv[i]=mul(mod-mod/i,inv[mod%i]);
fp(d,1,19){ lg[1<<d]=d; fp(i,0,(1<<d)-1)
r[d][i]=(r[d][i>>1]>>1)|((i&1)<<(d-1));
}
for(Rg int t=(mod-1)>>1,i=1,x,y;i<262144;i<<=1,t>>=1){
x=qpow(3,t),y=qpow(iG,t),G[0][i]=G[1][i]=1;
fp(k,1,i-1) G[1][i+k]=mul(G[1][i+k-1],x),G[0][i+k]=mul(G[0][i+k-1],y);
}
}
inline void NTT(int* a,int tp){ fp(i,0,limit-1) if(i<r[d][i]) swap(a[i],a[r[d][i]]);
for(Rg int mid=1,I=2;mid<limit;mid<<=1,I<<=1) for(Rg int j=0,y;j<limit;j+=I) fp(k,0,mid-1)
y=mul(G[tp][mid+k],a[j+k+mid]),a[j+k+mid]=dec(a[j+k],y),a[j+k]=inc(a[j+k],y);
if(tp) return ; fp(i,0,limit-1) a[i]=mul(a[i],inv[limit]);
}
void Inv(int* a,int* b,int n){
static arr C,D; if(n==1) return b[0]=qpow(a[0]),void();
Inv(a,b,(n+1)>>1),init(n); fp(i,0,n-1) C[i]=a[i],D[i]=b[i];
fp(i,n,limit-1) C[i]=D[i]=0; NTT(C,1),NTT(D,1);
fp(i,0,limit-1) C[i]=mul(C[i],mul(D[i],D[i])); NTT(C,0);
fp(i,0,n-1) b[i]=dec(inc(b[i],b[i]),C[i]); fp(i,n,limit-1) b[i]=0;
}
void Sqrt(int* a,int* b,int n){
static arr D,F; if(n==1) return b[0]=sqrt(a[0]),void();
Sqrt(a,b,(n+1)>>1); fp(i,0,n<<1) F[i]=0;
Inv(b,F,n),init(n); fp(i,0,n-1) D[i]=a[i];
fp(i,n,limit-1) D[i]=0; NTT(D,1),NTT(b,1),NTT(F,1);
fp(i,0,limit-1) b[i]=mul(inc(b[i],mul(D[i],F[i])),inv[2]);
NTT(b,0); fp(i,n,limit-1) b[i]=0;
memset(D,0,limit<<2),memset(F,0,limit<<2);
}
inline void Direv(int* a,int* b,int n){
fp(i,1,n-1) b[i-1]=mul(a[i],i); b[n-1]=b[n]=0;
}
inline void Inter(int* a,int* b,int n){
fp(i,1,n-1) b[i]=mul(a[i-1],inv[i]); b[0]=0;
}
inline void Arcsin(int* a,int* b,int n){
static arr A,B,C; Direv(a,A,n),init(n),NTT(a,1);
fp(i,0,limit-1) B[i]=dec(1,mul(a[i],a[i])); NTT(B,0);
fp(i,n,limit-1) B[i]=0; Sqrt(B,C,n),Inv(C,B,n),NTT(A,1),NTT(B,1);
fp(i,0,limit-1) A[i]=mul(A[i],B[i]); NTT(A,0); Inter(A,b,n);
}
inline void Arctan(int* a,int* b,int n){
static arr A,B,C; Direv(a,A,n),init(n),NTT(a,1);
fp(i,0,limit-1) B[i]=inc(mul(a[i],a[i]),1);
NTT(B,0),Inv(B,C,n),NTT(A,1),NTT(C,1);
fp(i,0,limit-1) A[i]=mul(A[i],C[i]);
NTT(A,0); Inter(A,b,n);
}
} using namespace Poly;
int main(){
n=read(),tp=read(),prep(n);
fp(i,0,n-1) a[i]=read();
if(tp) Arctan(a,b,n);
else Arcsin(a,b,n);
fp(i,0,n-1) print(b[i]);
return Ot(),0;
}
The underlying optimization moment before went to the first page ...
And so we understand the way Kang could prove it after Update solution to a problem (although we never feel Kang wants to understand)
Upd
With the help of God to understand the health of fish derivation process ... orz God fish Nacly_Fish
First, we all know that for a function exists:
\[F(x)=\int F'(x)\]
Do not care about borders, given uncertain and not more than what the remainder of the term ...
Well, this should be the correct formula of Yazi:
\[F(x)=\int F'(x) +R(x)\]
Wherein \ (R (x) \) is aLittle brotherThe remainder, you may think it is forced to be making it to the last item after integration (because of the constant term loss of information after derivation, after integrating information became engaged 0)
Due to the excellent properties of trigonometric and inverse trigonometric functions (Lv, unlimited number of items), the R out on wood
Then we consider the original problem:
For the first arcsin, so we can find its derivative, and then integrating solved, then how derivative it evaluates this stuff?
Well no nonsense direct proof finish the meal good thing:
\[\begin{aligned} \begin{cases} sin'(x)={dy\over dx} \\sin'(x) =cos(x) \end{cases} \\ \Rightarrow {dy\over dx}=cos(x) \\ {dx\over dy} ={1\over cos(x)} \\{d ~arcsin (y)\over dy} ={1\over \sqrt{1-y^2}} \end{aligned}\]
That is, a known value for x, the presence of:
\[\begin{aligned} arcsin'(x)={1\over \sqrt{1-x^2}} \\arcsin(x)=\int{1\over \sqrt{1-x^2}} \end{aligned}\]
So \ (Arcsin (x) \) represented by \ (x \) as a variable \ (arcsin (F (x) ) \) then for a polynomial are:
\[\begin{aligned}Arcsin(x)&=arcsin(F(x)) \\ Arcsin'(x) &=arcsin(F(x))' \\ Arcsin'(x) &=arcsin'(F(x)) F'(x)\\ Arcsin'(x) &={F'(x)\over \sqrt{1-F^2(x)}} \\ Arcsin(x) &=\int{F'(x) \over \sqrt{1-F^2(x)}} \end{aligned}\]
QED
Then Kenken \ (Arctan \) ? You can own the bite, as long as a similar method, the \ (tan '(x) = {1 \ over cos ^ 2 (x)} \) set like a
You can start your own push, ...
Then we tear down:
\[\begin{aligned} \begin{cases} tan'(x)={dy\over dx} \\tan'(x) ={1\over cos^2(x) } \end{cases} \\ \Rightarrow {dy\over dx}={1\over cos^2(x)} \\ {dx\over dy} =cos^2(x) \\{dx\over dy} ={cos^2(x)\over sin^2(x)+cos^2(x)} \\{dx\over dy} ={1\over 1+tan^2(x)} \\{d ~arctan (y)\over dy} ={1\over 1+y^2 } \end{aligned}\]
Then:
\[\begin{aligned} arctan'(x)= {1\over 1+x^2} \\arctan(x)=\int{1\over 1+x^2} \end{aligned}\]
Adhesive:
\[\begin{aligned}Arctan(x)&=arctan(F(x)) \\ Arctan'(x)&=arctan(F(x))' \\ Arctan'(x)&=arctan'(F(x)) F'(x)\\ Arctan'(x)&={F'(x)\over 1+F^2(x)} \\ Arctan(x)&=\int{F'(x) \over 1+F^2(x)} \end{aligned}\]