https://cspsjtest.noi.cn/page/compStudent/resultStudent.php?compID=83 \鱼是好东西 要多摸/
NOI 1984
IOI 1989 2000 Beijing
NOIP WC 1995
APIO 2007
CSP-JS 2019
discuss
二维偏序
CDQ
斜率优化
鸽鸽鸽1
鸽鸽鸽2
信息技术
2022/08/1 AC 200
2022/08/13 AC 100 RED
2022/10/6 AC P6242 【模板】线段树 3
2022/10/9 AC 300 + 100 ORANGE
2022/10/28 CSP-S 2022 while(true) rp++
2022/11/22 橙名+ 2 周年
2022/11/26 NOIP 2022 while(true) rp++
2023/01/17 AC 100 YELLOW
2023/08/23 换新头
2023/10/31 AC 500
2023/11/22 AFO + 3周年
// Author:WangJingze //
// Deep Dark Fantasy //
#include<bits/stdc++.h>
#define il inline
#define re register
using namespace std;
namespace DarkS{
//const int MAXN=;
typedef long long ll;
const int MAXSIZE=1,inf=0x7f7f7f7f;
char buf[MAXSIZE],*p1,*p2;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1, MAXSIZE,stdin),p1==p2)?EOF:*p1++)
il ll read(){ re bool f; re ll x=0; re char c=gc();
while(!isdigit(c)) f=c==45; c=gc();
while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=gc();
return f?-x:x;}
il void wt(re ll x){
if(x<0) putchar(45),x=-x;
if(x>9) write(x/10);
putchar(x-(x/10)*10+48); return;}
il void write(re ll x){
wt(x); putchar('\n'); return;}
il ll max(ll&a,ll&b){return a>b?a:b;}
il ll min(ll&a,ll&b){return a<b?a:b;}
il void swap(ll&a,ll&b){a^=b^=a^=b;}
}using namespace DarkS;
//--------------------------------------//
//il void init(){return;}
signed main(){//int t=read(); while(t--){ init();}
return 0;}#include<bits/stdc++.h>
using namespace std;
const long long MAXN=110,mod=1e9+7;
struct node{
long long mat[MAXN][MAXN];
inline void init(){memset(mat,0,sizeof(mat));}
inline void idmat(){for(int i=0;i<MAXN;i++) for(int j=0;j<MAXN;j++) mat[i][j]=i==j?1ll:0;}
inline node operator*(const node &other)const{ node res; res.init(); long long pre;
for(int i=0;i<MAXN;i++){for(int k=0;k<MAXN;k++){ pre=mat[i][k];
for(int j=0;j<MAXN;j++) res.mat[i][j]=(res.mat[i][j]+other.mat[k][j]*pre)%mod;
}}return res;
}inline node operator^(long long &x)const{
node res,base; res.idmat();
for(int i=0;i<MAXN;i++) for(int j=0;j<MAXN;j++) base.mat[i][j]=mat[i][j]%mod;
while(x){
if(x&1) res=res*base;
base=base*base; x>>=1;
}return res;
}
};
const int MAXN=1e5+10;
long long a[MAXN];
struct node{int l,r; long long pre,add;};
struct segtree{
node tre[MAXN*4];
inline void build(int l,int r,int pos){
tre[pos].l=l; tre[pos].r=r;
if(l==r){tre[pos].pre=a[l]; return;}
int mid=(l+r)/2; build(l,mid,pos*2); build(mid+1,r,pos*2+1);
tre[pos].pre=tre[pos*2].pre+tre[pos*2+1].pre; return;
}inline void pushdown(int pos){
int mid=(tre[pos].l+tre[pos].r)/2;
tre[pos*2].pre+=tre[pos].add*(mid-tre[pos].l+1);
tre[pos*2+1].pre+=tre[pos].add*(tre[pos].r-mid);
tre[pos*2].add+=tre[pos].add;
tre[pos*2+1].add+=tre[pos].add;
tre[pos].add=0; return;
}inline long long getsum(int l,int r,int pos){
long long sum=0; if(l<=tre[pos].l&&tre[pos].r<=r) return tre[pos].pre;
pushdown(pos); int mid=(tre[pos].l+tre[pos].r)/2;
if(l<=mid) sum+=getsum(l,r,pos*2);
if(r>mid) sum+=getsum(l,r,pos*2+1);
return sum;
}inline void adding(int l,int r,long long exc,int pos){
if(l<=tre[pos].l&&tre[pos].r<=r){
tre[pos].pre+=(tre[pos].r-tre[pos].l+1)*exc;
tre[pos].add+=exc; return;
}pushdown(pos); int mid=(tre[pos].l+tre[pos].r)/2;
if(l<=mid) adding(l,r,exc,pos*2);
if(r>mid) adding(l,r,exc,pos*2+1);
tre[pos].pre=tre[pos*2].pre+tre[pos*2+1].pre; return;
}
}sgt;
int main(){
node a; a.init();
long long n,k; scanf("%lld%lld",&n,&k);
for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%lld",&a.mat[i][j]);
a=(a^k);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++) printf("%lld ",a.mat[i][j]);
printf("\n");
}return 0;
}#define il inline
#define re register
#define ui unsigned int
#define ul unsigned long long
namespace IO {
const ui MAXSIZE = 1 ;
char buf[MAXSIZE], *p1, *p2;
#define gc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ? EOF: *p1++)
il ui read(){
re ui res=0; re char c=gc();
while(!isdigit(c)) c=gc();
while(isdigit(c)) res=(res<<1)+(res<<3)+(c^48),c=gc();
return res;
}
il void write(re ui x){
if(x>9) write(x/10);
putchar(x-(x/10)*10+48); return;
}
} using namespace IO;