刷了这套题  感触良多 我想 感觉上的差一点就是差很多吧 . 每次都差一点  就是差很多了... 不能气馁..要更加努力去填补那一点点.  老天不是在造物弄人,而是希望你用更好的自己去迎接自己. A. Alyona and copybooks 有n本书  还需要买k本使得(n+k)%4==0 有三种  一本 a元  两本 b元  三本 c元的 不能分开卖 问至少花多少 枚举一下即可  ... 我居然一开始搞了个dp记录买1-4本的最优策略....还wa了.... #include <stdio.…
题目链接: http://codeforces.com/contest/740/problem/D D. Alyona and a tree time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positiv…
https://codeforces.com/contest/1143/problem/E 题意 p为n的一个排列,给出有m个数字的数组a,q次询问,每次询问a数组区间[l,r]中是否存在子序列为p的循环排列 题解 预处理出值x在排列中的上一个值_p[x] 从左向右扫一遍a数组,维护值x最后出现的地方\(pre[x]\),和每个位置i在排列顺序下前j个数在数组中的位置\(par[i][j]\)(倍增),然后能处理出每个位置i在排列顺序下前n-1个数的位置\(v[i]\) 线段树维护v数组的区间最…
B. Alyona and a tree 题目连接: http://codeforces.com/contest/739/problem/B Description Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the g…
A. Alyona and mex 题目连接: http://codeforces.com/contest/739/problem/A Description Alyona's mother wants to present an array of n non-negative integers to Alyona. The array should be special. Alyona is a capricious girl so after she gets the array, she…
D. Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive intege…
题目链接 http://codeforces.com/contest/740/problem/C 题意:有一串数字,给你m个区间求每一个区间内不含有的最小的数,输出全部中最小的那个尽量使得这个最小值最大,然后把符合条件的数字串输出,输出任意一种即可 这题只要理解题意差不多就能做出来了,很简单 由于题目要求的mex要最大(mex指着个区间中的数在0-n中缺少的最小的数字例如mex(1,2)=0,mex(0,2)=1,mex(0,1)=2) 所以尽量要从零开始递增,那么最小的mex值肯定是区间最小的…
A.(分类讨论) 题意:你有n本书,有三种买书方案,花a元买1本,花b元买2本,花c元买3本,问最少花多少钱,使得你书的总数是4的倍数 分析:分类讨论的题,但是要注意你可以买超过4本书--可以买5本.6本.7本让你达到4的倍数 B.=w= C.(构造) 题意:设mex[i][j]表示一段区间i,j内最小的没出现过的非负整数,你有m个询问[x,y],构造一个数组a,使得m个询问对应的区间中mex最小的最大. 分析:易得让最短的区间的值填0..ans-1,构造的话就是先把最短区间从x到y依次填上0.…
A. Alyona and copybooks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal…
D. Alyona and a tree Problem Description: Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edg…