牛客暑期ACM多校 第七场】的更多相关文章

链接:https://www.nowcoder.com/acm/contest/145/C来源:牛客网 C .题目描述 A binary string s of length N = 2n is given. You will perform the following operation n times : - Choose one of the operators AND (&), OR (|) or XOR (^). Suppose the current string is S = s1…
第二场终于等来学弟 开始(被队友带飞)的开心(被虐)多校之旅 A   run A题是一个递推(dp?)+前缀和 因为看数据量比较大 就直接上前缀和了 一个比较简单的递推 没有太多难点 签到题 需要注意的一个点是在最后求前缀和相减取模的过程中先加上一个MOD 防止相减变成负数 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std…
(重新组队后的第一场组队赛 也是和自己队友的一次磨合吧 这场比赛真的算是一个下马威吧……队友上手一看 啊这不是莫队嘛 然后开敲 敲完提交发现t了 在改完了若干个坑点后还是依然t(真是一个悲伤的故事)然后换我上去查 在经历了一番玄幻操作之后 不知为啥就过了…… J Different Integers 题目大意就是一个数组, 长度n<=1e5  q次询问(l, r)  输出区间[1, l]  [r, n]中不同数字的个数  q<=1e5 一开始上了莫队的板子 但是t掉了 后来发现题目中有个隐藏的…
HPrefix Sum study from : https://blog.csdn.net/mitsuha_/article/details/81774727 k较小.分离x和k. 另外的可能:求a[k][x],x不确定,想到的是求sum(a[k][1]+a[k][2]+...+a[k][x]),树状数组 sum(x)-sum(x-1).这题用不上. #include <cstdio> #include <cstdlib> #include <cmath> #incl…
链接:牛客网暑期ACM多校训练营(第四场):A Ternary String 题意:给出一段数列 s,只包含 0.1.2 三种数.每秒在每个 2 后面会插入一个 1 ,每个 1 后面会插入一个 0,之后第一个数字消失.求最后为空串需要多少秒. 题解: (1)如果在消除一个 0 前经过了 n 秒,那么消掉这个 0 需要 n + 1 秒. (2)如果在消除一个 1 前经过了 n 秒,那么消掉这个 1 与其产生的所有数需要 (n + 1) * 2 秒. (3)如果在消除一个 2 前经过了 n 秒,那么…
链接:牛客网暑期ACM多校训练营(第五场):F - take 题意: Kanade有n个盒子,第i个盒子有p [i]概率有一个d [i]大小的钻石. 起初,Kanade有一颗0号钻石.她将从第1到第n打开盒子.当她打开一个盒子时,如果里面有一颗钻石并且比它的钻石大,那么她将用她的钻石代替它. 现在您需要计算预期的替换次数. 您只需要输出答案模块998244353. 注意:如果x%998244353 = y * d%998244353,那么我们表示x / y%998244353 = d%99824…
牛客网暑期ACM多校训练营(第二场) 水博客. A.run 题意就是一个人一秒可以走1步或者跑K步,不能连续跑2秒,他从0开始移动,移动到[L,R]的某一点就可以结束.问一共有多少种移动的方式. 个人感觉是带约束条件的超级楼梯问题.说是dp其实就是递推吧.只要连续的两秒不是跑的就可以.所以在已经跑了i步的时候,直接考虑最后一步是跑的还是走的就可以了. 所以公式就是dp[i]=dp[i-1]+dp[i-1-k];然后前缀和预处理一下,直接从L的for到R的就可以了. 反正乱七八糟就出来了.现在写题…
牛客网暑期ACM多校训练营(第一场) A.Monotonic Matrix 这个题就是给你一个n*m的矩阵,往里面填{0,1,2}这三种数,要求是Ai,j⩽Ai+1,j,Ai,j⩽Ai,j+1 ,问你一共有几种填法. 变形一下就会发现其实是走非交叉格子路径计数,限制条件下的非降路径问题.就是从左上到右下走格子路径.从上到下为0——n,从左到右为0——m. 考虑 01 和 12 的分界线,是 (n, 0) 到 (0, m) 的两条不相交(可重合)路径,因为起点重合了,所以把其中一条路径往左上平移了…
牛客网暑期ACM多校训练营(第三场)H Diff-prime Pairs (贡献) 链接:https://ac.nowcoder.com/acm/contest/141/H来源:牛客网 Eddy has solved lots of problem involving calculating the number of coprime pairs within some range. This problem can be solved with inclusion-exclusion meth…
2018牛客网暑期ACM多校训练营(第二场)I- car 链接:https://ac.nowcoder.com/acm/contest/140/I来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 White Cloud has a square of n*n from (1,1) to (n,n). White Rabbit wants to know the maximum…
layout: post title: 2019牛客暑期多校训练营(第五场)G - subsequeue 1 (一题我真的不会的题) author: "luowentaoaa" catalog: true tags: mathjax: true - ACM-ICPC 题意 给你两个由数字组成的字符串\(S\),\(T\) 长度为\(1e3\),问你S中有多少个子序列的值大于字符串T: 思路 首先在比赛的时候一眼确定是\(N^2\) 复杂度的DP,但是想了两三个小时却没想到怎么转移,各种…
传送门 J-Counting Triangles_2021牛客暑期多校训练营3 (nowcoder.com) 题目 Goodeat finds an undirected complete graph with n vertices. Each edge of the graph is painted black or white. He wants you to help him find the number of triangles (a, b, c) (a < b < c), such…
牛客编程巅峰赛S2第4场 牛牛摆玩偶 题目描述 牛牛有\(n(2 \leq n \leq 10^5)(2≤n≤105)\)个玩偶,牛牛打算把这n个玩偶摆在桌子上,桌子的形状的长条形的,可以看做一维数轴. 桌子上有 \(M\) 个互不相交的区间\((1≤M≤10^5)\),这些区间上面可以放玩偶.一个位置只能放一个玩偶,玩偶之间的距离越大越美观,牛牛想最大化 D 的值,其中 D 为最近的两个玩偶之间的距离.请帮牛牛求出 D 的最大可能值. 示例1 输入 5,3,[[0,2],[4,7],[9,9]…
链接:https://www.nowcoder.com/acm/contest/145/C 来源:牛客网 题目描述 A binary string s of length N = 2n is given. You will perform the following operation n times : - Choose one of the operators AND (&), OR (|) or XOR (^). Suppose the current and s2i. For examp…
所有牛客多校的做题记录请右转队伍wiki Name Date Rank 2018 Multi-University,Nowcoder Day 1 2018.7.19 16/338 5/10 https://acm.ecnu.edu.cn/wiki/index.php?title=2018_Multi-University,Nowcoder_Day_1 2018 Multi-University,Nowcoder Day 2 2018.7.21 57/338 4/11 https://acm.ec…
链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1,…
链接:https://www.nowcoder.com/acm/contest/147/A来源:牛客网 Niuniu has recently learned how to use Gaussian elimination to solve systems of linear equations. Given n and a[i], where n is a power of 2, let's consider an n x n matrix A. The index of A[i][j] an…
链接:https://www.nowcoder.com/acm/contest/147/D来源:牛客网 Niuniu likes traveling. Now he will travel on a special graph. Given k and n, The directed graph contains n vertices, which are numbered from 0 to n - 1. For the vertex i, and for 1 <= j <= k, ther…
https://www.nowcoder.com/acm/contest/144/G 链接:https://www.nowcoder.com/acm/contest/144/G来源:牛客网 In Viridian forest there is a tree T formed by N nodes, each edge on which has a positive weight. There is an undirected graph G generated from tree T, whi…
链接:https://www.nowcoder.com/acm/contest/140/B来源:牛客网 题目描述 White Rabbit wants to buy some drinks from White Cloud. There are n kinds of drinks, and the price of i-th drink is p[i] yuan per bottle. Since White Cloud is a good friend of White Rabbit, whe…
链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网 同构图:假设G=(V,E)和G1=(V1,E1)是两个图,如果存在一个双射m:V→V1,使得对所有的x,y∈V均有xy∈E等价于m(x)m(y)∈E1,则称G和G1是同构的,这样的一个映射m称之为一个同构,如果G=G1,则称他为一个自同构. 题目描述 Two undirected simple graphs and where are isomorphic when there exists…
链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them such that: the rest integers have only one mode an…
链接:https://www.nowcoder.com/acm/contest/141/J来源:牛客网 Eddy has graduated from college. Currently, he is finding his future job and a place to live. Since Eddy is currently living in Tien-long country, he wants to choose a place inside Tien-long country…
链接:https://www.nowcoder.com/acm/contest/141/A来源:牛客网 Eddy was a contestant participating in ACM ICPC contests. ACM is short for Algorithm, Coding, Math. Since in the ACM contest, the most important knowledge is about algorithm, followed by coding(impl…
链接:https://www.nowcoder.com/acm/contest/141/E来源:牛客网 Eddy likes to play with string which is a sequence of characters. One day, Eddy has played with a string S for a long time and wonders how could make it more enjoyable. Eddy comes up with following…
链接:https://www.nowcoder.com/acm/contest/141/C来源:牛客网 Eddy likes to play cards game since there are always lots of randomness in the game. For most of the cards game, the very first step in the game is shuffling the cards. And, mostly the randomness in…
链接:https://www.nowcoder.com/acm/contest/140/I来源:牛客网 White Cloud has a square of n*n from (1,1) to (n,n). White Rabbit wants to put in several cars. Each car will start moving at the same time and move from one side of one row or one line to the other…
链接:https://www.nowcoder.com/acm/contest/140/D来源:牛客网 White Cloud has built n stores numbered from 1 to n. White Rabbit wants to visit these stores in the order from 1 to n. The store numbered i has a price a[i] representing that White Rabbit can spend…
链接:https://www.nowcoder.com/acm/contest/140/A来源:牛客网 White Cloud is exercising in the playground. White Cloud can walk 1 meters or run k meters per second. Since White Cloud is tired,it can't run for two or more continuous seconds. White Cloud will mo…
链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网 Two undirected simple graphs and where are isomorphic when there exists a bijection on V satisfying  if and only if {x, y} ∈ E2. Given two graphs and , count the number of graphs satisfying the foll…