题解 | Subarray-2019牛客暑期多校训练营第二场J题

AI内容安全治理:大模型多层过滤技术实践 人工智能生成内容(AIGC)在爆发式增长的同时,也带来了淫秽、虚假、侵权等违规风险。其底层原理涉及语义理解、图像识别、行为建模与上下文推理的多模态协同;技术价值在于构建可解释、可审计、可迭代的内容风控体系,显著提升平台合规效率与用户信任度。典型应用场景包括社交平台实时审核、教育内容净化、青少年模式智能防护等。本文聚焦AI内容安全治理中的大模型多层过滤机制,深入解析语义+图像+行为+上下文四维联防的技术实现路径与工程落地要点。 阅读详情

题目来源于牛客竞赛:https://ac.nowcoder.com/acm/contest/discuss
题目描述:
Given an array A of length 109 containing only 1 and -1. The number of 1 is not more than 107.
Please count how many pairs of (l, r) satisfy ∑i=1rAi\displaystyle\sum_{i=1}^{r} A_ii=1∑r​Ai​>0 and 0 ≤l ≤r ≤109.

输入描述:
The first line of input contains an integers N indicating how many segments of A is 1.
Following N lines each contains two space-separated integers li,ri indicating that Aj is 1 for li ≤j ≤ri

0<n≤106
li≤ri
li+1<li+1 for 0≤i<n-1
0≤l0
rn-1<109
∑(ri−li+1)\sum_{}^{} (r_i-l_i+1)∑​(ri​−li​+1)≤107

输出描述:
Output one line containing an integer representing the answer.

示例1:
输入
1
0 1

输出
4

示例2:
输入
1
1 2

输出
5

示例3:
输入
2
0 1
3 4

输出
16

题解:
• Data structure, brute force
Since there are at most 107 ones, possible index included in any positive sum segment will be O(107).
We can first find out all these indexes. Then, for each possible indexes range we can compute the result almost brute forcely.

代码:

#include <bits/stdc++.h>
using namespace std;
#define M 2048576
#define TM 30485777
#define BS 20000020
const int INT = 999999999;
int n , ptr;
vector< pair< pair<int,int> , int > > vv;
inline int value( int x ){
  while( ptr < n && vv[ ptr ].first.second < x ) ptr ++;
  return vv[ ptr ].second;
}
void init(){
  scanf( "%d" , &n );
  int pre = 0;
  for( int i = 0 ; i < n ; i ++ ){
    int li , ri; scanf( "%d%d" , &li , &ri );
    if( pre < li ) vv.push_back( { { pre , li - 1 } , -1 } );
    vv.push_back( { { li , ri } , +1 } );
    pre = ri + 1;
  }
  if( pre <= INT ) vv.push_back( { { pre , INT } , -1 } );
}
int ps[ M ] , ss[ M ] , pm[ M ] ,  sm[ M ];
void pre_build(){
  n = (int)vv.size();
  for( int i = 0 ; i < n ; i ++ ){
    ss[ i ] = ps[ i ] = ( vv[ i ].first.second - vv[ i ].first.first + 1 ) *
                        vv[ i ].second;
    if( i ) ps[ i ] += ps[ i - 1 ];
  }
  for( int i = n - 2 ; i >= 0 ; i -- )
    ss[ i ] += ss[ i + 1 ];
  for( int i = 0 ; i < n ; i ++ ){
    pm[ i ] = ss[ i ];
    if( i ) pm[ i ] = max( pm[ i ] , pm[ i - 1 ] );
  }
  for( int i = n - 1 ; i >= 0 ; i -- ){
    sm[ i ] = ps[ i ];
    if( i < n - 1 ) sm[ i ] = max( sm[ i ] , sm[ i + 1 ] );
  }
}
vector< pair<int,int> > itv;
void find_useful(){
  for( int i = 0 ; i < n ; i ++ ){
    if( vv[ i ].second > 0 ){
      itv.push_back( vv[ i ].first );
      continue;
    }else{
      int lft = vv[ i ].first.first;
      int rgt = vv[ i ].first.second;
      int lb = pm[ i ] - ss[ i ];
      int rb = sm[ i ] - ps[ i ];
      if( lb + rb >= rgt - lft + 1 ){
        itv.push_back( vv[ i ].first );
        continue;
      }
      if( lb > 0 )
        itv.push_back( { lft , lft + lb - 1 } );
      if( rb > 0 )
        itv.push_back( { rgt - rb + 1 , rgt } );
    }
  }
  size_t sz = 1;
  for( size_t i = 1 ; i < itv.size() ; i ++ )
    if( itv[ i ].first > itv[ sz - 1 ].second + 1 )
      itv[ sz ++ ] = itv[ i ];
    else
      itv[ sz - 1 ].second = itv[ i ].second;
  itv.resize( sz );
}
int cnt[ TM ] , pos , cur;
inline void add( int xi ){
  if( xi <= pos ) cur ++;
  cnt[ xi ] ++;
}
inline void sub( int xi ){
  if( xi <= pos ) cur --;
  cnt[ xi ] --;
}
inline int query( int xi ){
  while( pos < xi ){
    pos ++;
    cur += cnt[ pos ];
  }
  while( pos > xi ){
    cur -= cnt[ pos ];
    pos --;
  }
  return cur;
}
int sv[ TM ];
long long ans;
void find_ans(){
  for( auto _ : itv ){
    int lft = _.first , rgt = _.second;
    int psum = BS; pos = BS; cur = 0;
    add( BS );
    for( int i = lft ; i <= rgt ; i ++ ){
      psum += value( i );
      ans += query( psum - 1 );
      add( sv[ i - lft ] = psum );
    }
    for( int i = lft ; i <= rgt ; i ++ )
      sub( sv[ i - lft ] );
    sub( BS );
  }
}
void solve(){
  pre_build();
  find_useful();
  find_ans();
  cout << ans << endl;
}
int main(){
  init();
  solve();
}

更多问题,更详细题解可关注牛客竞赛区,一个刷题、比赛、分享的社区。
传送门:https://ac.nowcoder.com/acm/contest/discuss

【学习笔记-QGIS】 QGIS从零快速上手 安装文章参考:https://zhuanlan.zhihu.com/p/370633306。 阅读详情

相关推荐

antdv-<a-form>的使用

是 Ant Design Vue 中用于创建表单的组件,提供了一种结构化的方式来收集用户输入。它支持多种布局、验证、数据绑定等功能,非常适合用于处理用户输入和提交数据。

2302_81312344的博客 2625

2019牛客多校第二场 J subarray

题目链接:https://ac.nowcoder.com/acm/contest/882/J 开场发现咖啡鸡过了,然后发现好像能做,然后用了树状数组2e7*logn,超时,过了20%,之后才去签H的到。 赛后看了一眼题解,发现因为是连续的,直接用数组,不用树状数组,改了一晚上一上午,答案错误,通过率从53%到76%到80%,然后就实在想不到错哪了,弃疗了。 牛逼网友链接:https://ww...

binarycopycode 991

DataWorks数据安全治理最佳实践

DataWorks基于数据安全治理的常见思路,针对资产梳理、技术体系建设和运营体系建设,提供了一系列数据安全产品能力,您可通过“基础防护建设、数据安全防护措施及策略增强建设、数据安全持续运营”三个阶段在DataWorks上落地数据安全治理项目。参考本文启动数据安全治理项目前,建议您先了解DataWorks数据安全产品相关能力了解DataWorks数据安全产品能力后,您可参考如下三个阶段在DataWorks上落地数据安全治理项目。

soso1968的博客 1446

2019牛客暑期多校训练营(第二场)J Subarray

#2019牛客暑期多校训练营(第二场)J Subarray 题意: 长度为1e91e91e9的区间AAA下标为[0,1e9−1][0,1e9-1][0,1e9−1],数输入nnn个区间,[li,ri][l_i,r_i][li​,ri​]区间类的值为1,其余为-1,问有多少区间和大于0. 题解: 看了来自大佬的博客,能够产生贡献的点最多只有3e73e73e7个,意思是先求一个前缀和,然后画成图应该是...

尘的博客 613

用Scratch实现凯撒密码:图形化编程与古典密码学的趣味结合

字符编码与移位运算是计算机处理文本数据的基础原理之一,它通过将字母映射为数字实现信息转换。在密码学领域,凯撒密码作为最经典的替换密码,直观地展示了基于规则字符替换的加密思想,其核心价值在于通过简单算法揭示加密解密的基本框架。这种原理在编程教育中尤为重要,能够帮助初学者理解循环、变量和字符串处理等核心概念。结合Scratch图形化编程环境,学习者可以通过拖拽积木可视化构建加密算法,将抽象的移位操作转化为交互式游戏。本项目以凯撒密码为例,通过实时密钥调整和动态字母表映射,生动演示加密过程,并自然融入暴力破解和密

weixin_32428571的博客 317

不用公网IP,如何在内网高效搭建RustDesk远程控制服务器?基于Windows Server 2019的完整实践

本文详细介绍了在Windows Server 2019上部署RustDesk远程控制服务器的完整实践方案,无需公网IP即可实现内网高效远程控制。从环境准备、基础服务安装到网络与安全配置,提供了零成本的私有化部署指南,适用于企业、校园等内网环境。

weixin_28737073的博客 461

2019牛客暑期多校训练营(第二场) J Subarray(思维)

题目链接:https://ac.nowcoder.com/acm/contest/882/J 题目大意:在一个长度为1e9的序列上,选择n段为1,其他位置全部为-1,求区间和>0的区间数量 题目思路:这题思维难度挺大的,即使大概理解了题目做法还是没能自己实现出来照着题解打了一遍..首先先处理两个数组f[i],g[i],f[i]表示这一段的右端点最多能延伸出多大的前缀和,g[i...

smilestruggler_Fly To Higher 477

从实验室到晶圆厂:一文看懂二维半导体(如MoS2)的CVD生长与晶体管制造挑战

本文深入探讨了二维半导体(如MoS2)从实验室研究到晶圆厂量产的CVD生长与晶体管制造关键技术挑战。重点分析了晶圆级二维半导体的CVD生长工艺优化、晶体管制造的四大界面工程难题,以及掺杂与集成的产业化解决方案,为二维半导体在集成电路领域的应用提供技术参考。

weixin_42651748的博客 476

「2019牛客多校第二场 J」subarray【dp+差分思想】

题目链接:https://ac.nowcoder.com/acm/contest/882/J 题意 有一个长度为10910^9109的只包含111和−1-1−1的数组,然后给你n(n&lt;=106)n(n&lt;=10^6)n(n<=106)个区间[li,ri][l_i,r_i][li​,ri​],表示只有这nnn个区间内的所有数为111,其余的位置的数都为−1-1−1,...

wzw 633

cartographer基于3d地图的纯定位模式

关于纯定位模式呢,本人试过2d和3d,怎么说呢,有条件的话,建议直接上3d,因为博主当初在做定位时针对室内和室外都尝试过,2d只在室内环境下效果会很棒,但是在室外就呵呵啦!所以这里直接讲解3d室外定位(建图篇请自己查看我之前的博客:[3d建图](https://blog.csdn.net/qq_40216084/article/details/105531983) 看了我之前的博客大概知道配置文件和源文件路径了,我这里就不把路径写出来了,挺麻烦的。直接讲怎么做把,有不懂的留言,看到了我一定知无不言。 **首

qq_40216084的博客 5559

Android 13.0 设置默认屏幕亮度百分比

在13.0的系统ROM产品开发中,在一些产品开发中,对于设置默认屏幕亮度和屏幕亮度百分比的功能,在开发中也是常见的功能,在10.0的平台设置可能有一些不同,一般的都是在SettingProvider中设置就可以了 在11.0以后的系统中设置默认屏幕亮度的方法就不同了,接下来具体分析功能的实现

安卓兼职framework和app工程师的博客 1562

2019牛客暑期多校训练营(第二场)----J-Subarray

首先发出题目链接: 链接:https://ac.nowcoder.com/acm/contest/882/J 来源:牛客网 涉及:分治 点击这里回到2019牛客暑期多校训练营解题—目录贴 题目如下: 代码如下: #include <iostream> #include <cstring> using namespace std; typedef long long ...

weixin_43702895的博客 315

Verilog HDL 100道面试题及参考答案

在 Verilog HDL 中,参数(parameter)和宏定义(define)都可用于定义常量,但它们存在诸多不同之处。参数(parameter)是模块内部的常量定义,具有局部性。它在模块内部起作用,不同模块可以有同名的参数,且值可以不同。参数通常用于定义模块的一些配置信息,例如数据位宽、延迟时间等。参数的定义和使用是在模块的作用域内进行的,通过参数传递可以方便地对模块进行配置。endmodule在上述代码中,WIDTH是一个参数,用于定义加法器的位宽。通过改变WIDTH。

大模型大数据攻城狮的专栏 1742

2019牛客暑期多校训练营(第二场)

目录 A 、Eddy Walker(打表找规律+数学) D 、Kth Minimum Clique(第k小团) E 、MAZE(DP+线段树+矩阵) F、 Partition problem(爆搜) H 、Second Large Rectangle(单调栈 || DP) J 、Subarray(前缀和预处理+优化) A 、Eddy Walker 题意: 有n个点的环...

兜率工的博客 434

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

2019牛客暑期多校训练营(第二场)J Subarray

题解: 先算出每一段可能往左往右扩展多少个负数,那么对于负数过于长的一段,它的中间的一部分就被扔掉了。由于每个正数段最多往左右各扩宽自身的长度。所以负数最多只有2e7个。 接下来可以用树状数组统计,但是这样会多一个log。因为每次询问相较于上次只移动了一个单位所以直接统计在上次询问的基础上更改就好。代码挺短的...... #include <bits/...

qq_18869763的博客 206

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

J-Subarray_2019牛客暑期多校训练营(第二场)

题意 有一个只由1,-1组成的数组,给出所有连续的1所在位置,求满足1的个数大于-1的个数的子区间的数量 题解 参考博客:https://www.cnblogs.com/Yinku/p/11221494.html 考虑做前缀和,问题就转化成sum[i]-sum[j] > 0的对数, 由于数据范围较大不可能对整个数组前缀和,可以只计算对答案有贡献的区间的前缀和,需要对给出的线段1进行合并,...

weixin_30407613的博客 117

深度学习工具包 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")

2019牛客暑期多校训练营(第二场)J-Subarray(思维)

>传送门< 前言 这题我前前后后看了三遍,每次都是把网上相关的博客和通过代码认真看了再思考,然并卵,最后终于第三遍也就是现在终于看懂了,其实懂了之后发现其实没有那么难,但是的的确确需要思维。(博客分析那块写的啰里吧嗦又改了很多废话) 题意 在一个长度为$10^{9}$的序列上,保证只有$n(n<10^{6})$个区间等于$1$,且$1$的个数小于10^{...

weixin_30559481的博客 97

2018牛客多校赛第二场 G transform(二分答案 + 前缀和)

    大致题意:n个商店排成一列,对于每个商店i,他所在位置位pi,里面有ai个商品。现在你要在一个商店经营,位置任意选择。当你的商店东西卖完之后,你可以从旁边的商店调集商品到你的商店。每次调集一个商品的代价是距离的两倍。现在问你给你T这么多的钱,问你最多可以调集多少商品到你所在的商店。 朴素的想法就是暴力枚举你所在的位置,然后看T这么多钱最多可以从两边拿多少东西。我们可以二分我移动的...

alpc_qleonardo 410

原 2019牛客暑期多校训练营(第二场)补题记录

文章目录总结A:Eddy WalkerB:Eddy Walker 2H:Second Large Rectangle 总结 自闭场,A、B、F题都没肝出来。今天重感冒,状态不好,烦! 直接开始补题吧。 A:Eddy Walker 先去开的它,在开题20分钟左右就去写了一个打表的dfs,根据每个数的位置出现的比例与N,M的关系应该可以推出这道题。怎料!这个dfs的算法跑当N>=3的就能跑爆,擦...

KineXence的博客 865

牛客多校第二场j题

给你一段含1和-1的序列,序列长度固定为10910^9109,现在给你n个区间,区间内全为1,然后问你有多少个区间和大于0; 其中 li&lt;ril_i&lt;r_ili​<ri​ ri+1&lt;li+1r_i+1&lt;l_{i+1}ri​+1<li+1​ for 0 ≤i&lt;n−1\leq i &lt; n - 1≤i<...

weixin_43965698的博客 233

2019牛客暑期多校训练营(第二场)F-Partition problem(搜索)

给出2*n个人,以及给出他们之间的关系数值,现在要求将这些人分成两拨,一拨有n个人,然后求 这个最大 爆搜加剪枝。 比赛的时候演了自己一个多小时。。。 我以为那种直接在包含k个1的二进制间进行转移,上一个状态和这个状态只有两个位置的二进制不同,但是这种转移只是按照二进制的字典序从小到大排列的:(转移方法:) //从n个数字中选择k个数字(k<=n); int k; int com...

cy41的博客 415

2019湖南多校第二场-20190317

(有问题欢迎提出来 文章目录A:Potato SacksB:Hedwig's LadderC:Hedwig's LadderE:What time is it anyway?F:Left-Right-WinG:The Erdös-Straus ConjectureH:Subprime Fibonacci SequenceJ:Pinemi Puzzles A:Potato Sacks Solved...

打过ICPC/CCPC,学习ACM算法,Linux内核,Openharmony,加油努力开心珍惜 614

牛客网2018多校第一场J题

链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), coun...

weixin_30622107的博客 134

2019牛客多校第一场J题——Fraction Comparision(大数)

题目传送门 大致题意: 依次输入x,a,y,b,比较x/a和y/b的大小,前者大则输出“>”,后者大则输出“<”,相等则输出“=”。 0<=x,y<=10^18 1<=a,b<=10^9 解法一(正解): 解法二:C/C++高精度大数乘法 #include<stdio.h> #include<iostream> #include<c...

道阻且长,行则将至 551

2019牛客暑期多校训练营(第一场)补题记录

总结 总结放前面方便之后看自己总体上做的不好的地方,以便改正。 因为在实习,没有那么快开题,一进去后看到J题过的人多,就去做J,结果花了足足1小时才过。之后一直在肝B,以为是一道找规律加递归版逆元公式套过,结果没解出来。然后想套个simpson自适应来找规律,还是莫得办法。到第三个小时心态有点崩,看了概率的F,没积出来,靠,心态崩了。 总的来说,这次应该是提醒下次要全程状态在线,同时一道题如果快...

KineXence的博客 736

LeetCode-718:Maximum Length of Repeated Subarray (最长公共子数组) -- medium

给定两个数组A和B,寻找A和B中最长的公共子数组的长度

大树先生的博客 2262
上一篇: 题解 | Inside A Rectangle-2019牛客暑期多校训练营第二场I题
下一篇: 题解 | Graph Games-2019牛客暑期多校训练营第三场A题
牛客竞赛
博客等级 码龄7年 9粉丝 97原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值