题目链接:Codeforces Round #424 (Div. 2) E. Cards Sorting 题意: 将n个数放进一个队列,每次检查队首,看看是不是队列中最小的数,如果是就扔掉,如果不是就放到队尾。 这样直到队列为空,为需要操作多少次。 题解: 考虑用两个指针模拟,最开始now指针指向第 ...
分类:
其他好文 时间:
2017-07-15 15:56:28
阅读次数:
176
对叠放着的n张牌,第i张牌写有数字Ai,进行操作:将牌堆顶的牌取出,若是当前牌堆最小值就扔掉,否则放到牌堆底,求牌堆空时操作次数。 怎么看怎么像约瑟夫。。不过约瑟夫DP我不太熟,于是就yy了一下 “当前最小值”??优先队列。把Ai和i绑起来扔到优先队列里,就可以知道下一步要跳到哪里。 有个问题:如果 ...
分类:
其他好文 时间:
2017-07-15 13:46:37
阅读次数:
131
题意:有n个数字,我遍历过去,如果他是当前最小值,就删除,否则放到最后面去,问得遍历多少个数字,(直到所有数字消失 思路:我们保存每个数字的位置,这个数字是否能删除,如果他在上一个数字的最后一个位置后面就可以删除了,那么标记下+树状数组(我这里的y表示的就是上一个数删除的最后一个位置) ...
分类:
其他好文 时间:
2017-07-15 11:20:27
阅读次数:
198
将每个数字的位置存进该数字的vector中 原数组排个序从小到大处理,每次在vector里二分找到距离当前位置“最远”的位置(相差最大),更新答案 树状数组维护每个数字现在的位置和原位置之差 ...
分类:
其他好文 时间:
2017-07-14 22:06:44
阅读次数:
104
Ultra-QuickSort Ultra-QuickSort In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct ...
分类:
编程语言 时间:
2017-07-13 10:24:08
阅读次数:
169
代词的翻译 指明要点,不抽象不具体 1.It may seem strange to put into the same packet an industrial revolution and two political revolutions. But the fact is that they ...
分类:
其他好文 时间:
2017-07-10 23:39:11
阅读次数:
218
链接 分析:首先我们先对其进行排序,并看排序以后有多少个元素顺序是对的,接着我们看有多少个元素经过一次交换可以得到的,最后剩下的元素就是经过两次交换可以得到的了。 1 /* 2 PROB:sort3 3 ID:wanghan 4 LANG:C++ 5 */ 6 #include "iostream" ...
分类:
其他好文 时间:
2017-07-09 12:23:14
阅读次数:
125
Restricting and Sorting Data Limit the rows that are retrieved by a query 限制从查询中返回的行 Sort the rows that are retrieved by a query 对查询返回的行进行排序 Use amper ...
分类:
数据库 时间:
2017-07-02 21:18:38
阅读次数:
347
Sorting is one of the most usedoperations in real life, where Computer Science comes into act. It iswell-known that the lower bound of swap based sort ...
分类:
其他好文 时间:
2017-07-02 19:40:23
阅读次数:
156
Little Joty has got a task to do. She has a line of n tiles indexed from 1 to n. She has to paint them in a strange pattern. An unpainted tile should ...
分类:
其他好文 时间:
2017-07-02 17:44:01
阅读次数:
178