#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char input[1001][1001],judge;
int up[1001][1001],Left[1001][1001],Right[1001][1001];
int main(){
int m,n,lnear,rnear,answer,times;
scanf("%d",×);
for(int k=1;k<=times;k++){
answer=0;
scanf("%d%d",&m,&n);
memset(up,0,sizeof(up));
memset(Left,0,sizeof(Left));
memset(Right,0x7f,sizeof(Right));
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++){
scanf("%c",&judge);
if(judge==' '||judge=='\n')
if(j==1){
j=n;
i--;
}
else
j--;
else
input[i][j]=judge;
}
for(int i=1;i<=m;i++){
lnear=0;
for(int j=1;j<=n;j++)
if(input[i][j]!='R'){
up[i][j]=up[i-1][j]+1;
Left[i][j]=max(Left[i-1][j],lnear+1);
}
else
lnear=j;
rnear=n+1;
for(int j=n;j>=1;j--){
if(input[i][j]!='R')
Right[i][j]=min(Right[i-1][j],rnear-1);
else
rnear=j;
answer=max(answer,up[i][j]*(Right[i][j]-Left[i][j]+1));
}
}
printf("%d\n",answer*3);
}
return 0;
}
相关推荐
最佳解决Maven同一依赖多版本共存问题,重复依赖(同一个jar包,多个版本)-maven-shade-plugin
公司的历史项目在导出功能上引用的是poi-3.12版本,后续再做word模板导出功能时用到了poi-3.15版本,升级完后发现项目的很多导出功能都瘫痪了。用旧版本,新功能无法使用;用新版本,旧功能瘫痪,且整改的工作量比较大。使用maven-shade-plugin,将某个版本的依赖名称进行修改,重新引入即可。
HDU1505City Game(最大子矩阵)
题目链接:传送门 分析:题意大概就是要求一个由F和R构成的矩阵中,单单由F构成的最大矩阵 思路:运用到dp思想,但第一次做还是比较难想到,用一个dp数组记录高度,再用两个数组分别来表示某个点向左和向右延伸的最大宽度,最后再计算每块的面积就OK了 AC代码: #include&lt;iostream&gt; #include&lt;cstring&gt; using namespace std; i...
从零到一:手把手部署用友T3标准版11.2及SQL Server 2008R2环境
本文详细介绍了从零开始部署用友T3标准版11.2及SQL Server 2008R2环境的完整流程,包括环境准备、SQL Server安装、环境检测与修复、T3标准版安装实战以及初始化配置与测试。通过手把手的步骤指导和常见问题解决方案,帮助用户顺利完成部署,确保系统稳定运行。
【DP】 hdu1505 City Game
City Game http://acm.hdu.edu.cn/showproblem.php?pid=1505 Problem Description Bob is a strategy game programming specialist. In his new city building game the gaming environment is as foll
autodl云服务器使用中的conda源报错
通过find path -name filename找到.condarc文件,在autodl服务器中,一般在/root/.condarc。为了利用jypyter打开conda虚拟环境运行,需要下载ipykenel。这个报错是源的问题,在通过源获取包元数据时出现了HTTP 429错误。通过conda换源解决。修改.condarc文件,命令: vim .condarc。但这样还不能解决问题,得把报错中有问题的源注释掉。通过以下命令添加清华镜像源。把报错的链接源注释如下。
(9-2)离线强化学习:离线强化学习的主流方法
本文介绍了三种离线强化学习的主流约束策略优化方法:BCQ、CQL和Fisher-BRC,并通过CartPole环境进行性能比较。BCQ利用生成模型约束动作选择并引入扰动网络;CQL通过正则化Q值抑制对未见状态-动作对的高估;Fisher-BRC使用Fisher散度正则化策略分布。实验结果表明,三种方法各有优势,其中CQL表现最为稳定。文章还指出,为获得更好的性能,需要更大的数据集和更长的训练轮次。这些方法通过限制策略优化范围,有效提高了离线强化学习的稳定性和泛化能力。
game c++
一般而言,比起C程序来说,C++游戏程序是可重用和可维护的。可这真的有价值吗?复杂的C++可以在速度上与传统的C程序相提并论吗? 如果有一个好的编译器,再加上对语言的了解,真的有可能用C++写出一些有效率的游戏程序来。本文描述了典型的几种你可以用来加速游戏的技术。它假设你已经非常肯定使用C++的好处,并且你也对优化的基本概念相当熟悉。 第一个经常让人获益的基本概念显然是剖析(profiling
ResNet改进(20):融合Swin Transformer与ResNet
这种混合架构的设计理念是:在保留CNN强大局部特征提取能力的同时,引入Transformer的全局建模优势。我们实现的模型在ResNet18的基础上嵌入了一个简化版的Swin Transformer Block,旨在探索两种范式结合的可能性。通过在ResNet早期阶段引入Transformer模块,我们既保留了CNN强大的局部特征提取能力,又获得了Transformer的全局建模优势。本文提出的ResNet与Swin Transformer混合架构,探索了CNN与Transformer结合的可能性。
C++编程学习-第14周
金字塔的侧面是由四个大小相同的等腰三角形构成的。给出三角形的底和高,输出其中一个侧面的面积。3029 埃及金字塔。输入两个数分别是底和高。
损失函数大汇总(三十八)(AUCPR Loss附公式推导与代码)
本文系统介绍了AUCPR Loss的原理与应用。针对不平衡分类任务中AUC指标不够敏感的问题,提出通过优化PR曲线面积(AUCPR)来提升模型性能。文章详细推导了AUCPR的可微近似实现:首先用sigmoid函数软化阈值判断,构造可微的TP/FP/FN计数;然后基于软Precision和Recall计算近似PR曲线面积;最后通过数值积分得到可优化的损失函数。特别讨论了温度参数τ对训练稳定性的影响,并比较了AUCPR与AUC、AP等指标的异同。该方法适用于医学筛查、欺诈检测等极端不平衡场景,能更准确反映模型对
移动支付APP(仿支付宝)
Toast.makeText(PayActivity.this, "支付失败:" + payResponse.getMsg(), Toast.LENGTH_SHORT).show();Toast.makeText(PayActivity.this, "支付失败:" + t.getMessage(), Toast.LENGTH_SHORT).show();Toast.makeText(PayActivity.this, "支付失败", Toast.LENGTH_SHORT).show();
信息学奥赛一本通·编程启蒙 C++版 3021-3030(10题)
信息学奥赛一本通·编程启蒙 C++版 3021-3030(10题)
《QGIS快速入门与应用基础》209:重叠标注处理(移除/偏移)
系统讲解了QGIS中处理标注重叠问题的核心方法与实操流程。文章首先阐述了重叠标注处理的底层逻辑,即 先预防、再调整、后兜底 的递进式策略,并详细介绍了设置入口与界面布局。重点讲解了偏移处理这一首选方案,包括基础方向设置、最大偏移距离与步长配置、以及自动换行等进阶优化规则。针对不同要素类型(点、线、面)提供了行业规范的偏移方向设置建议,并给出从稀疏到密集场景的完整参数推荐值。最后以城市POI点图层为例,演示了5步偏移设置流程,帮助用户实现 无重叠、无压盖、重点突出 的专业标注效果。
2285 - 【入门】内部元素之和
输入一个整数矩阵,计算位于矩阵内部的元素之和。所谓矩阵内部的元素,不在第一行和最后一行的元素以及第一列和最后一列的元素。
廖雪峰Python教程[完整版]
廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白
Outlook Express 6 (OE6) for Win7/Win8/Win10
英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。
Life Game生命游戏的C++实现
因为上了鲍老师的课,每周都要做一次课堂练习。所以大三才想起来开C++的坑= = 代码是课上一个半小时写出来的。难免有考虑不周的地方。如果有什么问题,请各位不吝赐教~ 首先解释一下Life Game。开局一张棋盘,随便放几个棋子,然后每回合棋盘做一次更新,对棋盘的每个格子来说,看它周围的9个邻居在旧棋盘中的状态,有两个棋子则这个格子下回合是有棋的,有三个棋子则这个格子下回合状态不变,其余情况这个...
华为的C语言编程规范.pdf
华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。
装箱问题<DP><C++>
题目 题目:给出n个物品的体积,选取其中若干个物品装入容量为v的箱子中,剩余空间最小为多少?输出这个最小值. 输入格式: 第一行,输入箱子的容量v. 第二行,输入物品的个数n. 接下来n行,输入每个物品的体积. 输出格式:仅一行,输出箱子最小剩余空间. 例子: input: 24 6 8 3 12 7 9 7 output: 0 分析 用f[v]来表示前i个物品放入容量为v的箱子中的最大体积,d
深度学习工具包 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');```[](https://bitdeli.com/free "Bitdeli Badge")
导弹拦截<DP><贪心><C++>
程序#include<cstdio> #include<cstring> using namespace std; int main(){ int i=-1,a[1001],f[1000],max,min,tot=0; memset(f,0,sizeof(f)); while(scanf("%d",&a[++i])==1) { max=f[i];
HNOI 2016 暴力之旅
Day1T1看到这题,我瞬间想到用暴力做。 小小思考了一下,我便打起了暴力。 是这样的: 题目每次给出了俩点,和一个限制ta和tb,于是乎,我便从一个点开始,往周围延伸。延伸的标准是酱紫的,一条线能否延伸仅当这条线的a和b满足a≤ta,b≤tb。每次延伸,把这条边记录下vis,以后遇到这条边不再延伸。然后边延伸边记录下所有延伸到的a和b的最大值ma和mb。 然后延伸到不能延伸
【NOIP2015】求和<C++>
#include<cstdio> #include<cstring> using namespace std; int main(){ int n,m,cor; long sum=0; scanf("%d%d",&n,&m); long color[m+1][3][2],number[n+1],count[m+1][2]; memset(count,0,siz
乘积最大<DP><C++>
题目 题目:给出一个长度为n的数.问:如何在数中添加k个乘号,使乘积最大?输出这个最大值. 输入格式: 第一行,输入两个数n,k,中间有空格隔开. 第二行,输入这个长度为n的数. 输出格式:仅有一行,输出最大值. 例子: input: 4 2 1231 output: 62 分析
求排列的逆序数<归并><C++>
程序 #include using namespace std; void gb_b(int p[],int a[],int i,int j,int ans){ int e=(i+j)/2,q=i,w=0; do{ if(a[q]>a[e]) p[w++]=a[e++],ans++; else p[w++]=a[q++],p[w++]=a[e+
【Usaco2016 FEB】Load Balancing【线段树 + 二分】
大膜YZ哥题目大意给你一个矩阵,里面有些点,让你横向切一刀,纵向切一刀,使得得到的四个区域内的最大的点数最少。输入7 7 3 5 5 7 13 3 1 11 7 5 3 9 1输出2分析 首先,我们要枚举纵向是从哪里分开(从左往右扫),可以用离散化进行优化。 然后,我们需要二分来找一个横向分开的最优位置。我们先假设每次都可以知道从mid分开后,四个区域内每个区域的点数,那么我们便可以知
【Usaco2016 FEB】Fenced In
首先,大膜htn 然后,分析一下。 实际上,画个图,一下就可以找出规律了。 我们可以先处理出每一段门的费用,再排序,根据题目的特殊性,可以知道整个一行或一列的费用都可以很方便的表示出来。 根据最小生成树的思想,每次可以找出最小的费用,显然将那一整行都连通一定是最优的。然后进一步分析,又可以看到一个问题。每次打开的时候,如果本来就有连通的,就不用打开了。这个问题很容易可以解决,因为我们每一次都
HNOI2016 大数(number)
分析首先,我们要知道取模的几个性质: 设p=a+b,q=a*b 1.p%x=(a%x+b%x)%x 2.q%x=(a%x*b%x)%x 知道这两个性质之后,我们首先输入进要模的数x和字符串s,处理出一个后缀数组m,和一个po数组,m[i]表示字符串中从前往后数的第i位到结尾所组成的数字对x取模的结果是多少,po[i]表示10^i对x取模的结果。以样例来说明,m[3]表示1211对11取模的结
【Usaco2015 JAN】Moovie Mooving【DP】(发现自己有点不会写二分啊)
题目大意Bessie要在电影院里呆L分钟,这段时间他要看小型电影度过。电影一共N部,每部都播放于若干段可能重叠的区间,Bessie决不会看同一部电影两次。现在问他要看最少几部电影才能度过这段时间? 注:必须看电影才能在电影院里呆着,同时一场电影可以在其播放区间内任意时间入场出场。输入4 100 50 3 15 30 55 40 2 0 65 30 2 20 90 20 1 0输出3链接点我查
圈奶牛<计算几何><C++>
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; struct point{//x横坐标,y纵坐标. double x; double y; }p[10000],chosen[10000]; bool cmp(point a,poin
1万+



被折叠的 条评论
为什么被折叠?



