【BZOJ 4128】 matrix

【数据结构】期末考试复习(考点+例题) 1.线性表定义及其存储实现:顺序表和链接表,优缺点分析(顺序存储可随 机访问,链式存储可灵活利用空间),相关操作的时间复杂度。 2.链表的插入删除操作 3.两种特殊的线性表及其应用:栈、队列 4.栈、队列上的(插入/删除)操作及其特点 5.循环队列满和空的条件 6.能够定义线性表、栈、队列的数据存储结构,能够实现相关操作的算法并 分析时间复杂度(例如插入、删除及其它应用等) 7.理解线性结构的应用( 如根据要求能灵活定义线性表结构,能根据线性表 的插入、删除操作解决实际问题) 二叉树基本概念与性质(高 阅读详情

题目其实很简单,BSGS可以一眼看出来,但这就需要矩阵求逆,然而我并不会。。。
于是发现了一种BSGS的非求逆方法,借此介绍一下。

aix−y=b(modP)
推出
aix=b∗ay(modP)

因此我们只需要对每个b∗ayhash一下就好了,然后穷举i,验证是否存在即可。code:
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
int n,P;
struct hp{
    int num[71][71];
    bool operator < (const hp& a)const
      {
        int i,j;
        for (i=1;i<=n;++i)
          for (j=1;j<=n;++j)
            {
              if (num[i][j]<a.num[i][j]) return true;
              if (num[i][j]>a.num[i][j]) return false;
            }
        return false;
      }
    bool operator > (const hp& a)const
      {
        int i,j;
        for (i=1;i<=n;++i)
          for (j=1;j<=n;++j)
            {
              if (num[i][j]<a.num[i][j]) return false;
              if (num[i][j]>a.num[i][j]) return true;
            }
        return false;
      }
    bool operator == (const hp& a)const
      {
        int i,j;
        for (i=1;i<=n;++i)
          for (j=1;j<=n;++j)
            {
              if (num[i][j]<a.num[i][j]) return false;
              if (num[i][j]>a.num[i][j]) return false;
            }
        return true;
      }
}a,b;
hp mult(hp a,hp b)
{
    hp c;int i,j,k;
    for (i=1;i<=n;++i)
      for (j=1;j<=n;++j)
        {
          c.num[i][j]=0;
          for (k=1;k<=n;++k)
            c.num[i][j]=(c.num[i][j]+a.num[i][k]*b.num[k][j])%P;
        }
    return c;
}
int bsgs()
{
    int i,j,m;
    hp e,mi,xi;
    map<hp,int>x; 
    for (i=1;i<=n;++i)
      for (j=1;j<=n;++j)
        e.num[i][j]=b.num[i][j];
    m=(int)(sqrt(P)+0.5); x[e]=0;
    for (i=1;i<=m;++i)
      {
        e=mult(e,a);
        x[e]=i;
      }
    for (i=1;i<=n;++i) 
      for (j=1;j<=n;++j)
        {
          mi.num[i][j]=0;
          if (i==j)
            mi.num[i][j]=1;
        }
    for (i=1;i<=m;++i)
      mi=mult(mi,a);
    xi=mi;
    for (i=1;i<=m;++i)
      {
        if (x.count(mi)) return i*m-x[mi];
        mi=mult(mi,xi);     
      }
}
int main()
{
    int i,j;
    scanf("%d%d",&n,&P);
    for (i=1;i<=n;++i)
      for (j=1;j<=n;++j)
        scanf("%d",&a.num[i][j]);
    for (i=1;i<=n;++i)
      for (j=1;j<=n;++j)
        scanf("%d",&b.num[i][j]);
    printf("%d\n",bsgs());
}
chromium通信系统-ipcz系统(二)-ipcz系统代码实现-同Node通信 在chromium通信系统-mojo系统(一)-ipcz系统基本概念一文中我们介绍了ipcz的基本概念。 本章我们来通过代码分析它的实现。 handle系统 为了不对上层api暴露太多细节,实现解耦,也方便于传输,ipcz系统使用handle表示一个对象,handle类似于文件描述符,用IpczHandle类型表示ipcz系统内的一个对象。一个可以用IpczHandle 句柄表示的对象必须是APIObject子类。APIObject数据结构如下 class APIObject : public RefCou 阅读详情

相关推荐

Python自然语言处理 NLTK 库用法入门教程【经典】

@本文来源于公众号:csdn2299,喜欢可以关注公众号 程序员学府 本文实例讲述了Python自然语言处理 NLTK 库用法。分享给大家供大家参考,具体如下: 在这篇文章中,我们将基于 Python 讨论自然语言处理(NLP)。本教程将会使用 Python NLTK 库。NLTK 是一个当下流行的,用于自然语言处理的 Python 库。 那么 NLP 到底是什么?学习 NLP 能带来什么好处? ...

python函数基础教程 1万+

bzoj 4128: Matrix ——BSGS&&矩阵快速幂&&哈希

题目 给定矩阵A, B和模数p,求最小的正整数x满足 A^x = B(mod p). 分析 与整数的离散对数类似,只不过普通乘法换乘了矩阵乘法。 由于矩阵的求逆麻烦,使用 $A^{km-t} = B(mod \ p)$ 形式的BSGS。 然后就是判断矩阵是否相等, 一种方法是对矩阵进行Hash, 这里为了防止两个不同矩阵的Hash值冲突,使用了两个底数进行Hash。 ...

dianshu1593的博客 288

【向量数据库】Milvus向量数据库 ① 从入门到实战

Milvus是专为海量高维向量设计的开源数据库,支持AI搜索、图像识别、推荐系统等场景。相比传统关系型数据库(如PostgreSQL),它更高效处理语义检索、非结构化数据存储,可毫秒级响应亿级向量查询。单机场景下,推荐配置8GB内存/32GB硬盘,支持FAISS/HNSW等索引算法,支持GPU加速。本文涵盖CSDN专属部署教程(CentOS脚本/配置调优),提供避坑指南与扩展资源,并对比分析与传统数据库差异。适合算法工程师、AI开发人员快速上手,附官方下载与性能测试技巧,手把手教你搭建高效向量检索系统!

xiezhiyi007的专栏 1602

【BZOJ】4128: Matrix

题解 学习一下矩阵求逆 就是我们考虑这个矩阵 \(AA^{-1} = I\) 我们相当于让\(A\)乘上一个矩阵,变成\(I\) 我们可以利用初等行变换(只能应用初等行变换,或只应用初等列变换) 分三种 1.矩阵的两行互换 2.矩阵的一行加上k倍的另一行 3.矩阵的一行都乘上某个数 其实行变换的本质也可以写成一个矩阵! 我们把\(A\)消成1的过程中,对\(I\)进行同样的操作,就可以得...

weixin_30532987的博客 169

Spatial-ORMLLM: Improve Spatial Relation Understanding in the Operating Room with Multimodal Larg...

手术室(OR)中的精准空间建模是众多临床任务的基础,可为术中感知、风险规避及手术决策提供支持。现有方法虽利用大规模多模态数据集进行 latent 空间对齐,以隐式学习空间关系,但却忽视了多模态大型语言模型(MLLM)的3D能力。然而,这种方法存在两个问题:1)手术室通常缺乏多台视频和音频传感器,多模态3D数据难以获取;2)仅依赖易获取的2D数据训练,无法捕捉复杂场景中的细粒度细节。为解决这一问题,我们提出——首个针对手术室3D空间推理的大型视觉语言模型。

UnknownBody_2的博客 610

【YOLOv11工业级实战】15. YOLOv11海洋监测实战:珊瑚礁健康评估(水下图像增强|机器人搭载)

摘要:本文针对珊瑚礁健康评估的海洋监测需求,基于YOLOv11提出解决方案,聚焦水下色偏、悬浮物干扰、珊瑚形态复杂三大难题。引用全球珊瑚礁监测网络(GCRMN)标准,采用CoralNet数据集,通过Jaffe-McGlamery物理模型引导增强与悬浮物去除算法,在浑浊水域(能见度<5m)实现87.3%的健康珊瑚识别率,藻类误判率低至7.2%。介绍了以BlueROV2水下机器人和Jetson AGX Orin为核心的部署方案,结合水下SLAM定位技术,实现珊瑚健康的实时评估与三维覆盖率计算。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1659

BZOJ4128 Matrix 【BSGS】

BZOJ4128 Matrix Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) Input 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B Output 输出一个正整数,表示最小的可能的x,数据保证在p内有解 Sample Input 2 7 1 1 ...

Dream_maker的博客 363

STM32实战开发(99):基于STM32的智能交通灯控制系统设计与实现

随着城市化进程的加速和交通流量的不断增长,传统的交通灯控制系统已逐渐不能满足现代城市交通管理的需求。为了更好地提高交通效率、减少交通拥堵、降低事故发生率,智能交通灯控制系统成为了解决这一问题的重要途径。通过智能算法和自动化控制,智能交通灯控制系统能够根据实时交通流量和交通状况来自动调整红绿灯的切换,从而优化交通流和提高交通安全。STM32作为一款高性能的微控制器,具备较强的运算能力、丰富的外设接口和优良的功耗表现,非常适合用来设计和开发智能交通灯控制系统。

2201_76125393的博客 1233

BZOJ_4128_Matrix_矩阵乘法+哈希+BSGS

BZOJ_4128_Matrix_矩阵乘法+哈希+BSGS Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) Input 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B Output 输出一个正整数,表示最小的可能的x,数据保证在p内有解 Sam...

182

uniapp - 强力解决 swiper 轮播图内嵌套视频导致滑动不流畅卡顿问题,轮播滑块视图容器里既有图片也有视频video组件共同存在出现滑动切换特别卡,轮播组件包裹视频播放器加载慢及层级过高解决

uni-app,h5移动端网页,微信小程序,支付宝小程序,Android安卓,苹果ios,app,nvue,swiper,轮播图,轮播图嵌套视频,卡顿,加载慢,左右滑动不流畅,很卡,滑动过快就会卡住,uniapp使用swiper组件里嵌套视频与图片如何解决卡顿问题,详细解决教程,swiper里有视频video,播放器,视频+图片轮播,层级过高及卡顿问题,没等看完视频就自动切换了,报错,无法加载播放,uniapp的App安卓苹果端,video老是加载,APP端video组件播放视频卡顿,抖音,快手,上下滑动视

🏆 前端领域优质创作者 1万+

边缘AI工业落地:YOLO26-Seg + RK3588 NPU 极致部署(低功耗+实时实例分割,工业场景全覆盖)

本次实战汇总了「YOLO26-Seg+RK3588 NPU」工业边缘部署中最常见、最致命的8个坑点,所有坑点均来自真实工业项目,解决方案均为零代码/一键操作,无需复杂配置,能让你少走90%的弯路,节省大量时间,必看必记!❌ RKNN转换报错「算子不支持/模型加载失败」→ ✅ 导出ONNX时必须指定opset=12,重新导出即可,RK3588唯一兼容版本;❌ 分割mask错位/轮廓模糊 → ✅ 导出ONNX时加,并保证RKNN的归一化参数与YOLO26一致,零代码修复;

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1729

[BSGS 矩阵 随机化] BZOJ 4128 Matrix

其实完全不必求逆矩阵 判相同用了随机化 #include #include #include #include #include #define cl(x) memset(x,0,sizeof(x)) using namespace std; inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; if (p1==

雯舞 547

《AI 时代FPGA的全栈开发实战・从入门到精通》专栏启动说明

《智驱FPGA》专栏面向初学者,聚焦AI时代FPGA开发新范式,以ChatGPT、ICCoder2.0等工具全程辅助,覆盖纯逻辑、Zynq软硬协同、端侧AI加速、高速接口等核心方向。通过126节图文+14个实战项目,传授AI生成代码、Prompt工程、时序优化等能力,助力学员从零成长为具备工程竞争力的FPGA工程师,结业可独立完成完整项目并写入简历。

现任某外企的算法工程师!专注于人工智能、嵌入式、FPGA、论文写作四大主题的教程和经验分享!辅导请➕v :sci666888999 179

【BZOJ4128】Matrix BSGS+hash

【BZOJ4128】Matrix Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) Input 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B Output 输出一个正整数,表示最小的可能的x,数据保证在p内有解 Sample Input ...

aodanchui1057的博客 130

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Bzoj4128 Matrix

Time Limit:10 SecMemory Limit:128 MBSubmit:530Solved:279 Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) Input 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B Out...

dezhen7015的博客 187

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

BZOJ4128 Matrix

题目描述: 给定矩阵A,B和模数p,求最小的x满足A ^ x = B ( mod p)。(p是质数) 题解: 同样是BSGS,只是这道题放在了矩阵上。 其实并不需要矩阵求逆,将BSGS原理中的i * m + j 改为 i * m - j即可。 代码: #include<cmath> #include<cstdio> #include&lt...

a6t2007的博客 174

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

bzoj 4128 Matrix

http://www.elijahqi.win/archives/3248 Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) Input 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B Output 输出一个正整数,表示最小的可能的x,数据保证在p内有解 Sample Input ...

Elijahqi 250

bzoj4128 Matrix BSGS&hash

顺便学了一下矩阵求逆(其实就是一个高斯消元),不过后来没有用。        采用BSGS的思想,实际上令m=sqrt(p),那么就是求最小的i*m-j使得:       (A^m)^i=A^jB,其中A^j一共m个,可以预处理。        因此关键是快速判断两个矩阵是否相等。可以将矩阵看成一个大的p进制数然后将其取模后得到的值设为其hash值,判断为O(1);或者用另外一种方法,即将矩

lych的博客 1365

bzoj4128 Matrix

传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4128 【题解】 矩阵版本的BSGS。 至于如何不需要求逆,详见:http://www.cnblogs.com/galaxies/p/bzoj2480.html # include <map> # include <math.h> # in...

aklm45097的博客 113

bzoj4128 Matrix BSGS

Description 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) 对于100%的数据,n &lt;= 70,p &lt;=19997,p为质数,0&lt;= A_{ij},B_{ij}&lt; p Solution 说个题外话,打模拟赛的时候遇到题解说可以nlogn求离散对数,本蒟蒻太菜了希望能有哪位大爷教教我这是什么黑科技。。。 考虑直接BSGS,关键在于如何比...

olahiuj的博客 374

[BZOJ 4128]Matrix

矩阵求逆

_Horizon 648

BZOJ 4128 Matrix

BSGS+矩阵乘法

依然一笑作春温。 496

BZOJ4128: Matrix 矩阵BSGS

A^x=B(mod C) 令x=im-j A^(im)=BA^j(mod C) 这就不用求逆元了 #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #def

Dream in the Night 291

BZOJ 4128: Matrix (矩阵BSGS)

类比整数的做法就行了 1A爽哉 #include<bits/stdc++.h> using namespace std; typedef long long LL; const int MAXN = 75; const int sed = 137; int n, p; struct Matrix { int v[MAXN][MAXN]; Matrix(){ memset...

Ark 446
上一篇: 树上点分治学习记录
下一篇: 【JSOI 2008】【BZOJ 1014】火星人prefix
Lcomyn
博客等级 码龄12年 14粉丝 74原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址