2018SDIBT_国庆个人第五场】的更多相关文章

A - ACodeForces 1060A Description Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit. For example, "80123456789" and "80000000000" are ph…
A - Complete the Word(暴力) Description ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once.…
A - A codeforces 714A Description Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sonya is an owl and she sleeps during the day and stay awake from minute l1 to minute r1 inclusive. Also,…
A - A  这题很巧妙啊,前两天刚好做过,而且就在博客里  Little C Loves 3 I time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little C loves number «3» very much. He loves all things about it. Now he has a positive in…
A - A CodeForces - 1042A There are nn benches in the Berland Central park. It is known that aiai people are currently sitting on the ii-th bench. Another mm people are coming to the park and each of them is going to have a seat on some bench out of n…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=4528 小明系列故事——捉迷藏 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1464    Accepted Submission(s): 423 Problem Description 小明的妈妈生了三个孩子,老大叫大明, 老二叫…
t1应该比较水所以我都没看 感觉从思路上来说都不难(比牛客网这可简单多了吧) 第五场 t2: 比较套路的dp f[i]表示考虑前i个数,第i个满足f[i]=i的最大个数 i能从j转移需要满足 j<i ai>aj i-j>=ai-aj 比较easy的套路就是由2,3可以推出1 于是按照ai排序再拿个树状数组维护就行了 t3: 考虑一段编号能否成立 等价于求树链的并 然后发现对于l1>l2 r1>=r2 也就是说右端点单调 于是我们考虑做two-point-two 至于树链的并就…
NOI.AC省选赛 第五场T1 A. Mas的童年 题目链接 http://noi.ac/problem/309 思路 0x00 \(n^2\)的暴力挺简单的. ans=max(ans,xor[j-1]+xor[j-1]^xor[i]); 01trie树求最大异或和相信大家都会.不会看这里. 这与我们今天这个题目有关吗? 毫无关系. xor[i]的某一位为1,xor[j]的那一位不管是啥,贡献都是为1. 而xor[i]的某一位为0,xor[j]的贡献是2或0.(xor[j]位上为1贡献为2) (…
NOI.AC NOIP模拟赛 第五场 游记 count 题目大意: 长度为\(n+1(n\le10^5)\)的序列\(A\),其中的每个数都是不大于\(n\)的正整数,且\(n\)以内每个正整数至少出现一次. 对于每一个正整数\(k=1,..,n+1\),求出的本质不同的长度为\(k\)的子序列的数量.对\(10^9+7\)取模. 思路: 由于只会有一个数会重复,因此考虑重复的这个数取\(0\)个.\(1\)个和\(2\)个的情况,用组合数直接算即可. 源代码: #include<cstdio>…
链接:牛客网暑期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…
layout: post title: 2019牛客暑期多校训练营(第五场)G - subsequeue 1 (一题我真的不会的题) author: "luowentaoaa" catalog: true tags: mathjax: true - ACM-ICPC 题意 给你两个由数字组成的字符串\(S\),\(T\) 长度为\(1e3\),问你S中有多少个子序列的值大于字符串T: 思路 首先在比赛的时候一眼确定是\(N^2\) 复杂度的DP,但是想了两三个小时却没想到怎么转移,各种…
A.codeforces1038A You are given a string ss of length nn, which consists only of the first kk letters of the Latin alphabet. All letters in string ss are uppercase. A subsequence of string ss is a string that can be derived from ss by deleting some o…
A - Turn the Rectangles CodeForces - 1008B There are nn rectangles in a row. You can either turn each rectangle by 9090 degrees or leave it as it is. If you turn a rectangle, its width will be height, and its height will be width. Notice that you can…
链接:https://www.nowcoder.com/acm/contest/143/J来源:牛客网 There are n students going to travel. And hotel has two types room:double room and triple room. The price of a double room is p2 and the price of a triple room is p3 Now you need to calulate the min…
题目链接 首先利用组合数学知识,枚举两人的总胜场数容易得到 这还不是卷积的形式,直接搞的话复杂度大概是O(n^2)的,肯定会TLE.但似乎和卷积有点像?想半天没想出来..多谢Q巨提醒,才知道可以用下面这个公式进行转化 最后,化得的公式为 另外注意,上式右边是一个卷积的形式,但是,所得和的第一项是不需要加上的(不过图中公式没有体现).结合实际意义大概就是,i==0&&j==0时,gcd(i,j)不存在约数d,虽然0可以被任意正整数整除 & 第一项不为0 #include<bit…
比赛的时候脑瘫了没想出来..打多校以来最自闭的一场 显然从s中选择大于m个数组成的数必然比t大,所以只要dp求出从s中选择m个数大于t的方案数 官方题解是反着往前推,想了下反着推的确简单,因为高位的数优先级高,如果高位满足条件,那么低位只要用组合数求一下就行 #include<bits/stdc++.h> using namespace std; #define maxn 3005 #define ll long long #define mod 998244353 int n,m; char…
传送门: [1]:AtCoder [2]:UPC比赛场 [3]:UPC补题场 参考资料 [1]:https://www.cnblogs.com/QLU-ACM/p/11191644.html B.Reversi(记录结果再利用的DP) •参考资料 [1]:中国石油大学(华东), 张森 •题意 有 n 个石子,编号为 1~n ,第 i 个石子被涂成颜色 coli: 操作:任选两个颜色相同的石子 i,j ,i 与 j 之间的所有石子涂成颜色 coli: 上述操作可以不执行,也可以执行多次: 求最多有…
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; #define maxn 100005 #define maxk 256 int n,type,ans,sum,a[maxn],f[maxk][maxk],g[maxk][maxk]; bool v[maxk]; ];…
题目链接 题意 : 给你两个n*n的矩阵,然后两个相乘得出结果是多少. 思路 :一开始因为知道会超时所以没敢用最普通的方法做,所以一直在想要怎么处理,没想到鹏哥告诉我们后台数据是随机跑的,所以极端数据是不可能会有的,而我们一开始一直在想极端数据能接受的方法......后来看了鹏哥的做法,就是把是0的地方都跳过就可以了,用矩阵保存前一个非0数的位置是多少.二师兄给我看了一个代码,人家根本没用别的优化,直接将最里层k的循环提到了最外层,然后就AC了,对此我表示无语. #include <cstdio…
题目链接 题意 : 给你一个数列,可以随意交换两相邻元素,交换次数不超过k次,让你找出i < j 且ai > aj的(i,j)的对数最小是多少对. 思路 : 一开始想的很多,各种都想了,后来终于想出来这根本就是求逆序数嘛,可以用归并排序,也可以用树状数组,不过我们用树状数组做错了,也不知道为什么.求出逆序数来再减掉k次,就可以求出最终结果来了.求逆序数链接1,链接2 #include <stdio.h> ], right[]; long long count; void merge…
1001 Inversion 题意:求逆序对,然后交换k次相邻的两个数,使得剩下的逆序对最少. 分析:题目用到的结论是:数组中存在一对逆序对,那么可以通过交换相邻两个数使得逆序对减少1,交换k次,可以最多减少k个. 嘉定ai>aj,i < j,如果ai,aj相邻的,那么显然可以通过交换减少1:不相邻的情况, 考虑ak,k = j-1; #11:ak > aj,那么ak,aj构成逆序对,交换后逆序对减少1: #12:ak<=aj,那么ai,ak构成逆序对,问题转化为更小规模,可以通过…
题意很简单,就是两个大矩阵相乘,然后求乘积. 用 Strassen算法 的话,当N的规模达到100左右就会StackOverFlow了 况且输入的数据范围可达到800,如果变量还不用全局变量的话连内存开辟都开不出来 #pragma comment(linker, "/STACK:16777216") #include <iostream> #include <stdio.h> #define ll long long using namespace std; ;…
这题是2Y,第一次WA贡献给了没有long long 的答案QAQ 题意不难理解,解题方法不难. 先用归并排序求出原串中逆序对的个数然后拿来减去k即可,如果答案小于0,则取0 学习了归并排序求逆序对的方法,可以拿来当模板 TVT 贴代码了: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <iostream> #includ…
HDU 4911 Inversion 考点:归并排序 思路:这题呀比赛的时候忘了知道能够用归并排序算出逆序数,可是忘了归并排序的实质了.然后不会做-- 由于看到题上说是相邻的两个数才干交换的时候.感觉归并排序好像不是得要相邻的呀.然后就这样晕--刚才又一次看了才发现,归并就是相邻的交换的,正好是用来求逆序数的,唉--真的是做这个归并排序比赛就来了--真好! #include<iostream> #include<cstdio> #include<cstring> #in…
点击打开链接 我就不说官方题解有多坑了 V图那么高端的玩意儿 被精度坑粗翔了 AC前 AC后 简直不敢相信 只能怪自己没注意题目For the distance d1 and d2, if fabs(d1-d2)<1e-7, we think d1 == d2 有空再补充V图的做法吧..本人也是第一次接触V图 //大白p263 #include <cmath> #include <cstdio> #include <cstring> #include <se…
推断一个序列是否是有效是简单的. 可是推断序列是不是有多个解会出问题. 那么从i=0 ~l 假设读到问号,推断该问号成为(能否有效,该问号为)是否有效. 假设都有效,则必有多个解. 假设都无效,则无解. 假设一个有效,则把问号改成有效的括号. 代码实现例如以下 #include<stdio.h> #include<string.h> char s[1000005],tp[1000005]; int l; int pd() { int zuo,you,num,i; num=0; zu…
原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round5-H.html 题目传送门 - https://www.nowcoder.com/acm/contest/143/H 题意 给定一个序列 a[1..n],求下标字典序第 k 小的严格递增子序列 $1\leq n\leq 10^5, 0\leq k\leq 10^{18}$ 题解 树状数组. 我们首先考虑如何求出从每一个下标开始取序列,能得到多少个不同的严格递…
原文链接https://www.cnblogs.com/zhouzhendong/p/NowCoder-2018-Summer-Round5-F.html 题目传送门 - https://www.nowcoder.com/acm/contest/143/F 题意 有 $n$ 个箱子,第 $i$ 个箱子有 $p_i$ 的概率出现大小为 $d_i$ 的钻石.现在 小A 一开始手里有一个大小为 $0$ 的钻石,他会根据 $i$ 从小到大打开箱子,如果箱子里有钻石且比小 A 手中的大,那么小 A 就会交…
问题 J: Palindromic Password 时间限制: 3 Sec  内存限制: 128 MB提交: 217  解决: 62[提交][状态][讨论版][命题人:admin] 题目描述 The IT department at your school decided to change their password policy. Each password will have to consist of N 6-digit numbers separated by dashes, wh…
问题 C: Frosh Week 时间限制: 4 Sec  内存限制: 128 MB提交: 145  解决: 63[提交][状态][讨论版][命题人:admin] 题目描述 Professor Zac is trying to finish a collection of tasks during the first week at the start of the term. He knows precisely how long each task will take, down to th…