QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#53570#2304. 线图not_so_organic100 ✓49ms26468kbC++1113.5kb2022-10-05 13:30:502022-10-05 13:31:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-05 13:31:01]
  • 评测
  • 测评结果:100
  • 用时:49ms
  • 内存:26468kb
  • [2022-10-05 13:30:50]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(a,b,c) for(register int a=(b);a<=(c);++a)
#define dow(a,b,c) for(register int a=(b);a>=(c);--a)
using namespace std;
constexpr int MaxN=5000+5,MaxK=10+5,MaxT=((1<<20)|5),MaxA=6918+5,MaxB=1202+5,Sigma_0=93,Sigma_1=128,Mod=998244353;
constexpr char Str[Sigma_0+5]=" !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~";
constexpr char Miu_char[MaxK][MaxB*5]={
"!    ",
"     !    ",
"          !    !    ",
"                    $    !    $    !    ",
"                    $         $         9    &    !    &    9    !    &    &    !    ",
"                    $         $         m!   0         0    m!        0    0         0&   m    ,    Q    (    m    0&   (    !    ,    m    ,    (    Q    m    !    (    ,    (    !    ",
"                    $         $         <2   _         _    <2        _    _          e!  a0   6!   &(   H    a0    e!  H         6!   a0   6!   H    &(   a0        H    6!   H         g_#  N@   a$   B    Z0   m!   r    Z0   m!   N@   g_#  m!   4    *    !    m!   4    a$   N@   B    a$   r    *    m!   Z0   m!   m!   Z0   N@   *    !    4    m!   4    4    m!   a$   B    *    r    m!   m!   !    *    4    4    *    !    ",
"                    $         $          2$  6%        6%    2$       6%   6%        6^i  EU%  C2   ?F!  w$   EU%  6^i  w$        C2   EU%  C2   w$   ?F!  EU%       w$   C2   w$        Bb1$ 3T<  '9#  Q/   ^u*  |e   '3   ^u*  <e   3T<  Bb1$ <e   >%   q         |e   >%   '9#  3T<  Q/   '9#  '3   q    |e   ^u*  |e   <e   ^u*  3T<  q         >%   <e   >%   >%   |e   '9#  Q/   q    '3   |e   <e        q    >%   >%   q         *B4$  9A  d.$  K8   pR.  x<!  n)   YQ   ^C+  3 !  EE   E$   pR.   <!   9A  *B4$  <!  8,   i    T%   H    3 !  i)   E$   >    x<!  8,   d.$   9A  n)   i    K8   d.$  K8   EE   E$   <!   ,    YQ   T%   x<!  pR.  n)   x<!  YQ   EE   E$   3 !  ^C+  3 !   <!  pR.   9A  E$   >    ,    !    T%   H    8,    <!  i    8,   T%   H    E$   >    i)   3 !  i)   8,   x<!  d.$  i    n)   K8   <!   ,    E$   EE   E$   T%   YQ   x<!  n)   E$   EE   3 !   <!  ,    !    >    E$   >    H    T%   8,   i    >    E$   i)   8,   i    ,    <!   E$   T%   E$   !    ,    >    H    >    ,    !    ",
"                    $         $         -(-! wQ        wQ   -(-!      wQ   wQ        a@TX ?T@# %A%  oeM  .c   ?T@# a@TX .c        %A%  ?T@# %A%  .c   oeM  ?T@#      .c   %A%  .c        jK?v%9@|@ J:q! pC(  |;A) M%F  fi&  |;A) Z|H  9@|@ jK?v%Z|H  |M!  2/        M%F  |M!  J:q! 9@|@ pC(  J:q! fi&  2/   M%F  |;A) M%F  Z|H  |;A) 9@|@ 2/        |M!  Z|H  |M!  |M!  M%F  J:q! pC(  2/   fi&  M%F  Z|H       2/   |M!  |M!  2/        |v%+-^.}$!yAG( *&M  gy>@ 6d8# Qw,  g`Z  *H<6 sZO! d/E  T8#  gy>@ pH2# ^.}$!|v%+-pH2# mt.  Fe   u]$  S4   sZO! !5*  }0#  ?,   6d8# mt.  yAG( ^.}$!Qw,  Fe   *&M  yAG( *&M  d/E  }0#  'G   O!   g`Z  u]$  6d8# gy>@ Qw,  6d8# g`Z  d/E  T8#  sZO! *H<6 sZO! pH2# gy>@ ^.}$!T8#  ?,   O!        u]$  S4   mt.  pH2# Fe   mt.  u]$  S4   }0#  ?,   !5*  sZO! !5*  mt.  6d8# yAG( Fe   Qw,  *&M  'G   O!   }0#  d/E  }0#  u]$  g`Z  6d8# Qw,  T8#  d/E  sZO! pH2# O!        ?,   T8#  ?,   S4   u]$  mt.  Fe   ?,   }0#  !5*  mt.  Fe   O!   'G   }0#  u]$  T8#       O!   ?,   S4   ?,   O!        j*;o)3|eo *bR' s[J  |-#  Ey > |yD# *x.  #bp  b9%  jTP3 -SR! 'E)  ?RR  '=?  -z$  jTP3 |MR! 9wP  Nj$  Ey > '+?# 3|eo j*;o)'+?# p?2  { !  b7'  P=   2N   z!   |MR! nJ,  {Z   (}$  jG#  ,>   c2   -SR! nJ,  nk$  Y<   |yD# p?2  *bR' 3|eo 'E)  {Z   C3   E!   *x.  { !  s[J  *bR' |-#  s[J  9wP  nk$  C3   L=!  ^j   S*   a&   m!   ?RR  (}$  L=!  S*   #bp  b7'  |yD# Ey > b9%  P=   *x.  |yD# *x.  b9%  #bp  '=?  jG#  ^j   a&   ?RR  -z$  -SR! jTP3 'E)  -SR! ?RR  -z$  9wP  Nj$  |MR! jTP3 |MR! '+?# Ey > 3|eo Nj$  Y<   E!   S*   a&   g    J    .    !    -z$  ,>   S*   g    b7'  2N   p?2  '+?# P=   z!   { !  p?2  { !  P=   b7'  z!   2N   jG#  c2   a&   J    (}$  ,>   nJ,  |MR! {Z   nJ,  (}$  ,>   nk$  Y<   nJ,  -SR! nJ,  p?2  |yD# *bR' C3   E!   {Z   'E)  {Z   { !  *x.  s[J  |-#  ^j   a&   m!   .    L=!  S*   nk$  9wP  C3   nk$  L=!  S*   L=!  S*   (}$  ?RR  (}$  b7'  #bp  |yD# P=   b9%  *x.  b9%  ^j   a&   jG#  '=?  jG#  -z$  ?RR  -SR! 'E)  Nj$  9wP  |MR! '+?# a&   J    .    !    S*   g    Y<   Nj$  E!   Y<   S*   g    S*   g    ,>   -z$  ,>   2N   b7'  p?2  z!   P=   { !  P=   z!   a&   J    c2   jG#  c2   ,>   (}$  nJ,  {Z   Y<   nk$  nJ,  p?2  E!   C3   {Z   { !  m!   .    a&   ^j   a&   S*   L=!  nk$  C3   S*   L=!  (}$  b7'  P=   a&   ^j   jG#  -z$  Nj$  .    !    J    a&   J    g    S*   Y<   E!   g    S*   ,>   2N   z!   J    a&   c2   ,>   Y<   E!   .    m!   a&   S*   S*   a&   !    .    J    g    g    J    .    !    ",
"                    $         $         ^'Jk 8a,       8a,  ^'Jk      8a,  8a,       3WNs mrE:#zN|! =T%> Ch6  mrE:#3WNs Ch6       zN|! mrE:#zN|! Ch6  =T%> mrE:#     Ch6  zN|! Ch6       kt+&#}9tW*iVuV#*'q& pk_ -f~1C tp2$ pk_ -ErmK }9tW*kt+&#ErmK 0`s  ft%       f~1C 0`s  iVuV#}9tW**'q& iVuV#tp2$ ft%  f~1C pk_ -f~1C ErmK pk_ -}9tW*ft%       0`s  ErmK 0`s  0`s  f~1C iVuV#*'q& ft%  tp2$ f~1C ErmK      ft%  0`s  0`s  ft%       C u3-'Kn4+!)t~)Q9-*!s.%,.he<&&gZ*4 ~QL{ _[0E#s!.z#m7?R *}@# s.%,.<-j%&'Kn4+C u3-<-j%&eKX8 */o  >0-% AK0  s!.z#<5{- HRx! 10(  he<&&eKX8 !)t~)'Kn4+gZ*4 */o  Q9-*!!)t~)Q9-*!m7?R HRx! {p2  gH   ~QL{ >0-% he<&&s.%,.gZ*4 he<&&~QL{ m7?R *}@# s!.z#_[0E#s!.z#<-j%&s.%,.'Kn4+*}@# 10(  gH        >0-% AK0  eKX8 <-j%&*/o  eKX8 >0-% AK0  HRx! 10(  <5{- s!.z#<5{- eKX8 he<&&!)t~)*/o  gZ*4 Q9-*!{p2  gH   HRx! m7?R HRx! >0-% ~QL{ he<&&gZ*4 *}@# m7?R s!.z#<-j%&gH        10(  *}@# 10(  AK0  >0-% eKX8 */o  10(  HRx! <5{- eKX8 */o  gH   {p2  HRx! >0-% *}@#      gH   10(  AK0  10(  gH        nwk../M}!*E!0~*mv&t#v?i, OWWf#+d~'!WP*h XG9r$l&&1 PZs<-6*vo(6s*D v>_ #-MR} W%=, PZs<-*!=i(NLYy!sn{+ OWWf#R>n6 /M}!*nwk..R>n6 THAs 60y$ HQl6 n7s  u!:! O.%  *!=i(%|MN Pp!# NF>, 9!F& |L_  w4=  6*vo(%|MN L-q+ Ok]  +d~'!THAs E!0~*/M}!*6s*D Pp!# v7K  CG#  WP*h 60y$ mv&t#E!0~*v?i, mv&t#NLYy!L-q+ v7K  .SP# dt,! Hv-  @A&  xh   v>_ #NF>, .SP# Y>.  XG9r$HQl6 +d~'!OWWf#l&&1 n7s  WP*h +d~'!WP*h l&&1 XG9r$-MR} 9!F& dt,! |i&  v>_ #W%=, 6*vo(PZs<-6s*D 6*vo(v>_ #W%=, NLYy!sn{+ *!=i(PZs<-*!=i(R>n6 OWWf#/M}!*sn{+ Ok]  CG#  Y>.  |i&  Ob   ':   F#        W%=, |L_  Hv-  Ob   HQl6 u!:! THAs R>n6 n7s  O.%  60y$ THAs 60y$ n7s  HQl6 O.%  u!:! 9!F& w4=  @A&  ':   NF>, |L_  %|MN *!=i(Pp!# %|MN NF>, |L_  L-q+ Ok]  %|MN 6*vo(%|MN THAs +d~'!E!0~*v7K  CG#  Pp!# 6s*D Pp!# 60y$ WP*h mv&t#v?i, dt,! @A&  xh   F#   .SP# Hv-  L-q+ NLYy!v7K  L-q+ .SP# Hv-  .SP# Y>.  NF>, v>_ #NF>, HQl6 XG9r$+d~'!n7s  l&&1 WP*h l&&1 dt,! |i&  9!F& -MR} 9!F& W%=, v>_ #6*vo(6s*D sn{+ NLYy!*!=i(R>n6 |i&  ':   F#        Y>.  Ob   Ok]  sn{+ CG#  Ok]  Y>.  Ob   Hv-  Ob   |L_  W%=, |L_  u!:! HQl6 THAs O.%  n7s  60y$ n7s  O.%  @A&  ':   w4=  9!F& w4=  |L_  NF>, %|MN Pp!# Ok]  L-q+ %|MN THAs CG#  v7K  Pp!# 60y$ xh   F#   @A&  dt,! @A&  Hv-  .SP# L-q+ v7K  Y>.  .SP# NF>, HQl6 n7s  |i&  dt,! 9!F& W%=, sn{+ F#        ':   |i&  ':   Ob   Y>.  Ok]  CG#  Ob   Hv-  |L_  u!:! O.%  ':   @A&  w4=  |L_  Ok]  CG#  F#   xh   @A&  Hv-  Y>.  |i&       F#   ':   Ob   Ob   ':   F#        dd B#&=_j#cR5,&HG#v!6Mv( f KL |WOY+[D:W *U,# EirG$7g;0 N:i$ <;n$#BX!z&*ro= E+(t!y?[( 0eU!! U'- vHL  Msg5!NA@z%B{M7 g!zR!gFzl <To* 3o5& KJM! p>*  <;n$#9MAu&$/Yh! |(, f KL H;}#+&=_j#dd B#H;}#+BtQc u/A$ <k+  0U^6 $jy  3F6  <^I! B*&  s5!  p&   9MAu&-BMG +jp! ~9=- ]ZM  Te_' WZo  QX#  K%L  NA@z%^5IA 0:L! No + |L3& 9Ka  F<B  /@*  a[   BX!z&-BMG Qw9, j_h  |WOY+BtQc cR5,&&=_j#B{M7 0:L! XE&  5hI  QA5  n_#  AA!  9C   :#   *ro= +jp! 8!Q  --$  [D:W u/A$ HG#v!cR5,&*U,# <k+  6Mv( HG#v!6Mv( $/Yh!Qw9, 8!Q  /*W$ D0-  sgw! =W7  Ub   9A-  VQ$  g!zR!No + 5hI  a5'$ jhV! 6V4  G*+  +n#  g2   E+(t!~9=- /*W$ Tc7  EirG$0U^6 |WOY+f KL y?[( ]ZM  D0-  lk   7g;0 $jy  [D:W |WOY+*U,# [D:W N:i$ 3F6  7g;0 EirG$7g;0 gFzl |L3& QA5  jhV! ?Al  B%+  H(&  WF!  m)   0eU!!Te_' sgw! s2-  E+(t! U'- BX!z&<;n$#y?[( vHL  *ro= BX!z&*ro= y?[( E+(t!0eU!!vHL   U'- gFzl 3o5& KJM! p>*  g!zR!<To* NA@z%Msg5!B{M7 NA@z%g!zR!<To* $/Yh! |(, 9MAu&<;n$#9MAu&H;}#+f KL &=_j# |(, j_h  --$  Tc7  lk   s2-  UQ!  (%   so   47   O!   <To* 9Ka  n_#  6V4  B%+  O?!  ma   g2   3!    U'- WZo  =W7  UQ!  0U^6 <^I! BtQc H;}#+vHL  QX#  Ub   (%   $jy  B*&  u/A$ BtQc <k+  u/A$ 3F6  s5!  $jy  0U^6 $jy  s5!  p&   B*&  <^I! B*&  3o5& F<B  AA!  G*+  H(&  ma   $A   m)   X    Te_' K%L  9A-  so   ~9=- WZo  -BMG 9MAu&]ZM  QX#  +jp! -BMG +jp! ]ZM  ~9=- Te_' QX#  WZo  K%L  |L3& F<B  /@*  a[   No + 9Ka  ^5IA NA@z%0:L! ^5IA No + 9Ka  Qw9, j_h  -BMG BX!z&-BMG BtQc |WOY+cR5,&QA5  AA!  9C   :#   5hI  n_#  0:L! B{M7 XE&  0:L! 5hI  n_#  8!Q  --$  +jp! *ro= +jp! u/A$ [D:W HG#v!<k+  *U,# 6Mv( KJM! /@*  9C   +n#  WF!  g2   m)   G#   0    sgw! 9A-  VQ$  47   /*W$ =W7  Qw9, $/Yh!D0-  Ub   8!Q  Qw9, 8!Q  D0-  /*W$ sgw! Ub   =W7  9A-  VQ$  jhV! G*+  +n#  g2   a5'$ 6V4  No + g!zR!5hI  No + a5'$ 6V4  /*W$ Tc7  ~9=- E+(t!~9=- 0U^6 EirG$|WOY+D0-  lk   ]ZM  y?[( ]ZM  $jy  7g;0 [D:W *U,# 3F6  N:i$ 7g;0 ?Al  H(&  WF!  m)   jhV! B%+  |L3& gFzl QA5  |L3& jhV! B%+  sgw! s2-  Te_' 0eU!!Te_'  U'- E+(t!BX!z&vHL  y?[( *ro= y?[( vHL  KJM! p>*  3o5& gFzl 3o5& <To* g!zR!NA@z%B{M7  |(, $/Yh!9MAu&H;}#+p>*  a[   :#   g2   m)   3!   X    0    !    s2-  so   47   O!   Tc7  UQ!  j_h   |(, lk   (%   --$  j_h  --$  lk   Tc7  s2-  (%   UQ!  so   47   O!   B%+  ma   g2   3!   6V4  O?!  9Ka  <To* n_#  9Ka  6V4  O?!  =W7  UQ!  WZo   U'- WZo  <^I! 0U^6 BtQc Ub   (%   QX#  vHL  QX#  B*&  $jy  u/A$ <k+  s5!  3F6  $jy  p&   s5!  B*&  H(&  $A   m)   X    G*+  ma   F<B  3o5& AA!  F<B  G*+  ma   9A-  so   K%L  Te_' K%L  WZo  ~9=- -BMG QX#  ]ZM  +jp! ]ZM  QX#  /@*  a[   F<B  |L3& F<B  9Ka  No + ^5IA 0:L! j_h  Qw9, -BMG BtQc 9C   :#   AA!  QA5  AA!  n_#  5hI  0:L! XE&  --$  8!Q  +jp! u/A$ <k+  WF!  m)   G#   0    +n#  g2   /@*  KJM! 9C   /@*  +n#  g2   VQ$  47   9A-  sgw! 9A-  =W7  /*W$ Qw9, Ub   D0-  8!Q  D0-  Ub   +n#  g2   G*+  jhV! G*+  6V4  a5'$ No + 5hI  Tc7  /*W$ ~9=- 0U^6 lk   D0-  ]ZM  $jy  3F6  WF!  m)   H(&  ?Al  H(&  B%+  jhV! |L3& QA5  s2-  sgw! Te_'  U'- vHL  p>*  KJM! 3o5& <To*  |(, m)   X    0    !    g2   3!   a[   p>*  :#   a[   g2   3!   47   O!   so   s2-  so   UQ!  Tc7  j_h  (%   lk   --$  lk   (%   g2   3!   ma   B%+  ma   O?!  6V4  9Ka  n_#  UQ!  =W7  WZo  <^I! (%   Ub   QX#  B*&  s5!  p&   m)   X    $A   H(&  $A   ma   G*+  F<B  AA!  so   9A-  K%L  WZo  QX#  a[   /@*  F<B  9Ka  j_h  :#   9C   AA!  n_#  --$  G#   0    m)   WF!  m)   g2   +n#  /@*  9C   47   VQ$  9A-  =W7  Ub   g2   +n#  G*+  6V4  Tc7  lk   m)   WF!  H(&  B%+  s2-  p>*  0    !    X    m)   X    3!   g2   a[   :#   O!   47   so   UQ!  (%   3!   g2   ma   O?!  UQ!  (%   X    m)   $A   ma   so   a[   :#   0    G#   m)   g2   47   g2   m)   !    0    X    3!   O!   3!   X    0    !    "};
int Str_Rev[Sigma_1+5],Miu[MaxB];
struct Vertex
{
	int Fa;
	int head;
};
Vertex vt[MaxN];
int F[MaxN][MaxB];
struct Edge
{
	int u,v;
	int next;
};
Edge ed[MaxN<<1];
int Overall_Ed=1;
inline void Ins_edge(const int u,const int v)
{
	const int Ed=(++Overall_Ed);
	ed[Ed].u=u,ed[Ed].v=v;
	ed[Ed].next=vt[u].head;
	vt[u].head=Ed;
}
inline void Ins_Edge(const int u,const int v)
	{Ins_edge(u,v),Ins_edge(v,u);}
int A_lef[MaxK],A_rig[MaxK],A[MaxA],Idx[MaxA],the_A[MaxT];
int B_lef[MaxK],B_rig[MaxK],B[MaxB],Len[MaxB],the_B[MaxT];
int M_Tot[MaxB],Rho[MaxB],Rho_Rev[MaxB],Rho_B[MaxB];
vector<int> M_0[MaxB],M_1[MaxB];
struct Compare
	{inline bool operator () (const int u,const int v)
		{return (B[u]<B[v]);}};
inline void Dfs_Dynamic_Programming(const int u,const int B_rig)
{
	int v;
	F[u][1]=1;
	for(int e=vt[u].head;e;e=ed[e].next)
	{
		if((v=ed[e].v)==vt[u].Fa)
			continue;
		vt[v].Fa=u,Dfs_Dynamic_Programming(v,B_rig);
	}
	for(int e=vt[u].head;e;e=ed[e].next)
	{
		if((v=ed[e].v)==vt[u].Fa)
			continue;
		dow(i,B_rig,1)
		{
			if(!F[u][i]) continue;
			rep(j,1,M_Tot[i])
				F[u][M_1[i][j]]=(F[u][M_1[i][j]]+((long long)F[u][i]*F[v][M_0[i][j]]))%Mod;
		}
	}
}
int pit[MaxK<<1],arr[MaxK<<1];
int main()
{
	ios::sync_with_stdio(false),cin.tie(nullptr);
	int n,k;
	cin>>n>>k;
	int u,v;
	rep(i,2,n)
		cin>>u>>v,Ins_Edge(u,v);
	rep(i,1,k+1)
	{
		A_lef[i]=((A_rig[i]=A_rig[i-1])+1);
		rep(x,0,(1<<(i<<1))-1)
		{
			bool Flag=true;
			int Cum=0;
			rep(j,0,(i<<1)-1)
			{
				(((x>>j)&1)?(--Cum):(++Cum));
				if(((j==((i<<1)-1))&&Cum)||((j!=((i<<1)-1))&&(Cum<=0)))
					{Flag=false;break;}
			}
			if(Flag)
				the_A[x]=(++A_rig[i]),A[A_rig[i]]=x;
		}
	}
	rep(i,1,k+1) 
	{
		B_lef[i]=((B_rig[i]=B_rig[i-1])+1);
		rep(I,A_lef[i],A_rig[i])
		{
			const int x=A[I];
			int Cum=0,arr_Tot=0;
			rep(j,0,(i<<1)-1)
				if(((((x>>j)&1)?(--Cum):(++Cum))==1)&&j)
					pit[++arr_Tot]=j;
			rep(j,1,arr_Tot)
				arr[j]=Idx[the_A[(x>>(pit[j-1]+1))&((1<<(pit[j]-pit[j-1]))-1)]];
			sort(arr+1,arr+arr_Tot+1);
			int y=1;
			dow(j,arr_Tot,1)
				y=((y<<(Len[arr[j]]<<1))|B[arr[j]]);
			if(!the_B[y<<=1])
				the_B[y]=(++B_rig[i]),Len[B_rig[i]]=i,B[B_rig[i]]=y;
			Idx[I]=the_B[y];
		}
		rep(I,B_lef[i],B_rig[i]) Rho[I]=I,Rho_B[I]=B[I];
		sort(Rho+B_lef[i]+1,Rho+B_rig[i]+1,Compare());
		rep(I,B_lef[i],B_rig[i]) Rho_Rev[Rho[I]]=I,B[I]=Rho_B[Rho[I]];
		rep(I,A_lef[i],A_rig[i]) Idx[I]=Rho_Rev[Idx[I]];
	}
	rep(i,1,k+1)
		rep(I,B_lef[i],B_rig[i])
		{
			M_0[I].push_back(0),M_1[I].push_back(0);
			rep(j,1,k-i+1)
				rep(J,B_lef[j],B_rig[j])
					++M_Tot[I],M_0[I].push_back(J),M_1[I].push_back(Idx[the_A[(((B[J]|1)<<((i<<1)-1))^B[I])|(1<<(((i+j)<<1)-1))]]);
		}
	rep(i,0,Sigma_0-1) Str_Rev[Str[i]]=i;
	rep(i,1,B_rig[k+1])
		dow(j,4,0) Miu[i]=((Miu[i]*Sigma_0)+Str_Rev[Miu_char[k][((i-1)*5)+j]]);
	const int Tree_Root=1;
	Dfs_Dynamic_Programming(Tree_Root,B_rig[k+1]);
	int Answer=0;
	rep(i,1,n)
		rep(j,1,B_rig[k+1])
			Answer=(Answer+((long long)F[i][j]*Miu[j]))%Mod;
	cout<<Answer<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 10
Accepted
time: 9ms
memory: 23748kb

input:

4918 2
4804 4622
4907 4622
4458 4622
452 594
2547 3610
4120 4622
1141 3226
4681 4560
574 3512
606 4611
4622 2254
4181 3259
2903 4622
3507 4622
3932 3767
4834 4681
3909 2187
844 4681
4487 4357
392 2187
4622 3062
4897 3339
2350 4622
276 607
167 574
1859 4622
3785 3034
4587 4622
4622 123
332 3329
1476 ...

output:

2054279

result:

ok single line: '2054279'

Test #2:

score: 10
Accepted
time: 0ms
memory: 23896kb

input:

4967 3
406 1366
4429 2593
2361 1784
2216 4222
4605 2849
513 2593
4957 2593
3181 851
3133 2593
1272 2593
677 4007
2382 2593
2593 466
236 521
2593 4721
2393 167
2593 3570
4559 3293
1417 4619
2650 2593
2743 3703
1438 3971
1680 2593
2593 1655
4887 3520
2626 2593
3944 3192
1445 1116
2593 3464
4756 3971
6...

output:

19363085

result:

ok single line: '19363085'

Test #3:

score: 10
Accepted
time: 10ms
memory: 23816kb

input:

4938 4
3583 3442
2667 3583
4900 2643
1987 3583
4631 1482
3583 177
4804 3583
3583 1703
868 1435
3583 4642
3583 2172
3583 1525
498 880
1741 3583
2656 2016
3006 3583
3583 1783
798 2572
3478 3632
3583 334
1401 378
2844 3583
2226 832
845 3583
380 3095
3583 3546
2671 2101
3583 4854
3583 2957
3583 4547
300...

output:

281658722

result:

ok single line: '281658722'

Test #4:

score: 10
Accepted
time: 3ms
memory: 23820kb

input:

4904 5
3998 3631
1408 3998
2117 1419
4318 4446
1730 3737
2117 3516
3998 94
927 1361
3331 887
727 3998
3998 3392
3215 3305
3471 624
1568 3998
3976 1725
4171 2831
3998 4156
4681 4446
2045 3381
1962 3821
903 3603
68 4567
2370 4302
3998 4762
2779 496
1013 3998
3998 4310
829 1482
4520 3917
4759 4446
3737...

output:

461731477

result:

ok single line: '461731477'

Test #5:

score: 10
Accepted
time: 8ms
memory: 24120kb

input:

4946 5
1847 3628
192 3812
3323 3693
3378 4431
4204 2047
2356 3546
2821 3081
3812 3968
936 1973
1865 583
1708 3368
1227 3654
1877 583
583 2896
1197 3323
2976 2569
4065 149
4560 583
583 1327
92 2740
927 583
4091 583
583 2557
508 2877
4703 4500
3077 948
434 583
4165 4596
1871 583
1450 583
583 588
3413 ...

output:

832188398

result:

ok single line: '832188398'

Test #6:

score: 10
Accepted
time: 4ms
memory: 24436kb

input:

4944 6
4899 1585
2839 667
3425 2
1073 3447
1301 4647
567 2228
555 71
2472 1763
3164 3142
1248 1758
4647 442
706 1290
3425 3240
3183 2774
3434 1
52 3425
3356 2615
2464 3356
917 3705
4698 4647
1014 3991
2806 164
2358 2682
1236 1201
4896 4647
1616 4369
4647 3395
4647 2894
4647 2504
3356 1809
3164 4859
...

output:

676652490

result:

ok single line: '676652490'

Test #7:

score: 10
Accepted
time: 3ms
memory: 24872kb

input:

4910 7
2075 2466
2075 3254
3063 16
485 4235
348 2075
2477 1724
724 68
2075 1649
2075 2004
2255 970
4370 616
13 2075
2075 4551
4217 4601
2075 1503
3511 3140
3889 4354
2075 3223
3150 4430
609 4684
1248 2075
3873 3100
4601 1764
2075 4635
2075 738
1712 2075
3063 892
4441 2075
2621 2075
2075 795
3312 249...

output:

473253284

result:

ok single line: '473253284'

Test #8:

score: 10
Accepted
time: 21ms
memory: 25380kb

input:

4956 8
192 694
1016 2932
1838 2468
3170 694
1838 745
1547 4881
1322 2227
3337 4005
2480 625
1838 1852
694 1373
3930 3307
202 2069
4483 1420
3148 694
694 1940
694 2928
1422 3164
4066 4766
742 694
2373 19
1549 694
3955 2345
4066 4038
2332 694
3955 1626
3944 1077
691 694
2758 694
4559 4066
4786 3367
45...

output:

974515389

result:

ok single line: '974515389'

Test #9:

score: 10
Accepted
time: 49ms
memory: 25912kb

input:

4910 9
1193 3965
3965 4347
3965 146
3940 294
926 3654
1923 1054
4498 157
2166 3965
3965 2622
2612 3965
3965 2004
1906 3878
3380 4578
1089 33
3965 3300
3965 2407
3257 462
4055 2181
1435 3199
3965 985
4145 263
2092 3275
3965 1351
386 3965
3965 4436
3965 2441
4220 3965
3726 346
4004 4718
3965 4722
1180...

output:

840073763

result:

ok single line: '840073763'

Test #10:

score: 10
Accepted
time: 49ms
memory: 26468kb

input:

4988 9
2281 603
4913 3159
4428 3004
2535 2034
3556 3111
4469 878
686 3111
3111 3990
3187 768
2326 2700
699 3111
1520 1721
2203 613
2482 816
1444 3240
3111 3327
2771 3111
2478 3111
1920 1440
4186 4795
116 1734
267 3111
390 2017
259 687
67 3726
3892 976
3111 772
3004 648
3111 4617
3686 1889
2296 4255
...

output:

879764255

result:

ok single line: '879764255'

Extra Test:

score: 0
Extra Test Passed