H - Pair: normal and paranormal URAL - 2019】的更多相关文章

If you find yourself in Nevada at an abandoned nuclear range during Halloween time, you’ll become a witness of an unusual show. Here Ghostbusters hold annual tests for new versions of their proton packs. There are n Ghostbusters and n portable traps…
题目链接:http://codeforces.com/group/aUVPeyEnI2/contest/229669 时间限制:1s 空间限制:64MB 题目大意:给定一个长度为2n,由n个大写字母和n小写字母组成的字符串,将对应的字母两两连接,且不相交,按顺序输出没个大写字母对应的小写字母的位置,如果不存在则输出"Impossible" 样例: 解法: 手动建立结构体,维护一个栈 代码: #include<bits/stdc++.h> using namespace st…
2019. Pair: normal and paranormal Time limit: 1.0 secondMemory limit: 64 MB If you find yourself in Nevada at an abandoned nuclear range during Halloween time, you’ll become a witness of an unusual show. Here Ghostbusters hold annual tests for new ve…
Pair: normal and paranormal 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/H Description If you find yourself in Nevada at an abandoned nuclear range during Halloween time, you'll become a witness of an unusual show. Here Ghostbusters hol…
题意:在一个半圆内,有2*n个点,其中有大写字母和小写字母.其中你需要连接大写字母到小写字母,其中需要保证这些连接的线段之间没有相交. 如果能够实现,将大写字母对应的小写字母的序号按序输出. 析:我把它看成一个括号序列,然后用栈解决即可. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cs…
比赛题目链接 题意:有n个人每人拿着一把枪想要杀死n个怪兽,大写字母代表人,小写字母代表怪兽.A只能杀死a,B只能杀死b,如题目中的图所示,枪的弹道不能交叉.人和怪兽的编号分别是1到n,问是否存在能全部杀死的情况,如果存在则输出编号1到n的每个人杀死的怪兽的编号,如果不能输出"Impossible". 题解:贪心,用递归实现,判断相邻的是否能构成一对,优先构成相邻的,如果不能就递归到前面看是否能构成一对即可. #include<cstdio> #include<cst…
每次取相邻的两个可以射击的从序列中删除,重复n次. 可以看作括号序列的匹配. #include<cstdio> #include<vector> using namespace std; struct data { char c; int p; data(){} data(const char &cc,const int &pp) { c=cc; p=pp; } }; vector<data>a; typedef vector<data>::…
题目链接:http://codeforces.com/gym/100507/attachments ---------------------------------------------------------------------------- 刚看这题的时候感觉是区间$DP$ 然而复杂度一直停留在$O(n^3)$优化不下来 后来又瞎试了一些贪心 都在较大的数据上挂掉了 反复琢磨着大写字母和相应小写字母匹配 便想到了以前做过的括号匹配 只不过此题大写字母和小写字母的左右关系是不限制的 因…
题意:给你一个3个数A, B, C问有多少对pair(i, j),1 <= i <= A, 1 <= j <= B, i AND j > C或 i XOR j < C.A, B, C范围为1e9. 思路:场上一看以为是推式子加什么筛做,无果.之后才知道是数位DP(以下思路来自学长的代码orz).首先,我们可以把问题转化为求i AND j < C并且 i XOR j > C的数对个数,用总数(A* B)减去这个数.我们在DP过程中设置几个变量:ok1, 之前已…
 题目链接:https://ac.nowcoder.com/acm/contest/887/H  题意: 给定A,B,C问在[1,A]和[1,B]中有多少对x,y满足x&y>C或者x^y<C. 数据范围:1<=A,B,C<=1e9,测试用例 T<=100 . 思路: 根据题意本题可以用数位dp来解. /* and 0&0=0; 0&1=0; 1&0=0; 1&1=1; xor 0 ^ 0=0: 0 ^ 1=1: 1^ 0=1: 1^1=…
题目链接:https://ac.nowcoder.com/acm/contest/887/H 题意:给定A,B,C,求有多少对(x,y)满足x&y>C或者x^y<C,其中1<=x<=A,1<=y<=B. 思路:首先逆向考虑,求有多少对(x,y)满足x&y<=C且x^y>=C,然后用A*B去减它即可.然后就是数位dp模板题,用dp[pos][la][lb][land][lxor]表示到第pos位的个数,la位表示是否是A的上限,lb表示是否是B…
题意:给你三个数A,B,C 现在要你找到满足  A and B >C 或者 A 异或 B < C 的对数. 思路:我们可以走对立面 把既满足 A and B <= C 也满足 A 异或 B >= C的个数用数位dp统计出来 最后用A*B减去即可 #include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int N = 1e6+7; const int inf = 0…
题意: 传送门 给你\(A,B,C\),要求你给出有多少对\((x, y)\)满足\(x\in [1,A],y\in [1,B]\),且满足以下任意一个条件:\(x \& y > C\)或者\(x \oplus y < C\). 思路: 数位\(DP\),以前做的数位\(DP\)只是和一个数相关,今天是和两个数相关,有点神奇.这里我开了九维,第\(i\)位\(x\)是\(j\),\(y\)是\(k\),对\(第一种\)情况,对\(第二种\)情况,\(x\)到达上界,\(y\)到达上界,…
Pair 题意 给出A B C,问x取值[1,A]和y取值[1,B]存在多少组pair<x,y>满足以下最小一种条件,\(x \& y >c\),\(x\) xor \(y<c\) 分析 有关二进制位运算的操作肯定是和要联想到和位的关系的,我们可以考虑枚举每一位计数,但这样会复杂度爆炸,枚举每一位有没有想到什么?数位dp,我们可以考虑把题目条件装化,全集好求,那么求他的补集,求所有\(x \& y <=c\)并且\(x\) xor \(y>=c\),然后…
题意:https://nanti.jisuanke.com/t/41355 给出N1,计算公式:A=F(N)Ni=Ni-1 ^ (A*A),F为类斐波那契需要矩阵快速幂的递推式. 求第k个N. 思路: 发现从大约1e5个数开始N交替出现,到一定位置%2即可.(or正解:https://blog.csdn.net/qq_41848675/article/details/100667808   or https://blog.csdn.net/jk_chen_acmer/article/detail…
最近做的一场比赛,把自己负责过的题目记一下好了. Problem B URAL 2013 Neither shaken nor stirred 题意:一个有向图,每个结点一个非负值,可以转移到其他结点.初始时刻从结点出发,然后每次到达一个结点询问上一个到达的正值结点的权值,离开结点时也要询问一下,因为当前结点可能为正数,答案就是这个值了,如果不存在这个样的正权值输出“sober",或者不明确时输出“unkonwn”. 分析:可以当做树形dp来做.dp[u][0]表示进入结点时上一个正权值,dp[…
E Find the median 题意:每次往序列中增加连续的[l,r]的数,每加入一次就询问当前序列的中位数. 解法:此题没有要求在线,那么直接离线+线段树+二分就可以了.求出每个端点之后排序得到数组b,线段树每个叶子结点i存储的是区间[ b[i-1]+1,b[i] ]的系数(即当前序列有多少个[ b[i-1]+1,b[i] ]).修改时顺便维护当前总的数个数sum,然后处理询问就是直接在线段树上二分就可以了. #include<bits/stdc++.h> #define lc o*2…
Solved:5 Rank:296 E Find the median (线段树) 题意:最开始一个空的数组 4e5次操作 每次把Li,Ri中的每个数插入进来 问当前的中位数 题解:把这n个区间离散化去重以后 剩下m个点 可以分成m-1个连续的区间 有个巧妙的方法是把所有的右端点+1后 每两个点之间表示一个左闭右开的区间 然后线段树每个叶子节点就表示这个区间的信息 每次操作就是先区间更新再查询了 用la表示这个区间被覆盖了多少次 查询的时候类似整体二分 其实还可以维护一个叶子节点表示的区间长度…
Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair…
Oulipo Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6227    Accepted Submission(s): 2513 Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, wit…
Windows 常量定义在winuser.h中可以找到,如果了安装了visual studio 2010,winuser.h所在目录为C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include /***************************************************************************** ** winuser.h -- USER procedure declarations,…
学习:重点理解这句话的意思: next[j]会告诉我们从哪里开始匹配     模板题. Oulipo Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3612    Accepted Submission(s): 1428 Problem Description The French author Georges Perec (1936…
Oulipo Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7141    Accepted Submission(s): 2835 Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, wit…
Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair normal,…
KMP算法 求串内匹配数,计数时返回next[]位置. Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout s’affi…
Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23667   Accepted: 9492 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote…
介绍了Android SurfaceFlinger层次以下的图形合成和显示系统,主要基于高通MSM8k MDP4x平台. 做为Android Display专题.SurfaceFlinger的详细介绍参见链接文章. Android GDI之SurfaceFlinger SurfaceFinger按英文翻译过来就是Surface投递者.SufaceFlinger的构成并不是太复杂,复杂的是他的客户端建构.SufaceFlinger主要功能是: )将Layers(Surfaces)内容的刷新到屏幕上…
Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait faux. Tout avait Fair…
题目意思:找到上串在下串中有多少个 Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’affirmait fau…
Oulipo Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 36903   Accepted: 14898 Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quot…