题意:
分析:
翻转矩阵后,就是个二维卷积。
所谓二维卷积,其实就是把位置(i,j)映射到一个多项式的第i*m+j次项,然后就是一维卷积。。。
说得牛逼其实很傻
多的位置用0补齐即可。
复杂度 O ( R ∗ C + R ∗ C ∗ l o g ( R ∗ C ) ) O(R*C+R*C*log(R*C)) O(R∗C+R∗C∗log(R∗C))
#include<cstdio>
#include<cstring>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 1000010
#define MAXM 510
#define MOD 998244353
using namespace std;
typedef long long ll;
ll fsp(ll x,int y){
ll res=1;
while(y){
if(y&1)
res=res*x%MOD;
x=x*x%MOD;
y>>=1;
}
return res;
}
const int GG=3;