从后往前每个找出前面恰好留出k个位置 的位置就可以。//============================================================================// Name : F.cpp// Author : L_Ecry/...
分类:
其他好文 时间:
2014-07-28 11:37:40
阅读次数:
185
题目大意:
排队有人插队,每一次都插到第 i 个人的后面。
最后输出顺序。
思路分析:
你会发现,如果反向处理的话,你就知道这个人是第几个了。
那么问题一下子就简化了。
就是在线段树上找第几个空位置就行了。
#include
#include
#include
#include
#include
#define lson num<<1,s,mid
#defi...
分类:
其他好文 时间:
2014-07-28 00:14:39
阅读次数:
229
Buy Tickets
Time Limit: 4000MS Memory Limit: 65536K
Total Submissions: 12734 Accepted: 6292
Description
Railway tickets were difficult to buy around the Lunar New Year in China, so we must...
分类:
其他好文 时间:
2014-07-28 00:08:59
阅读次数:
399
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-07-27 09:49:52
阅读次数:
237
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie...
分类:
其他好文 时间:
2014-07-26 14:30:11
阅读次数:
156
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction ...
分类:
其他好文 时间:
2014-07-26 01:23:26
阅读次数:
229
You might be hunting for just cheap ghds nz a form of panache bracelets buy cheap ghd Straightener that higher round information. Common in photograph...
分类:
其他好文 时间:
2014-07-24 17:15:25
阅读次数:
260
The Fewest CoinsDescriptionFarmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a ...
分类:
其他好文 时间:
2014-07-24 17:11:36
阅读次数:
326
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on...
分类:
编程语言 时间:
2014-07-24 10:25:36
阅读次数:
227
class Solution {public: int maxProfit(vector &prices) { int len = prices.size(); if (len i2r(len, 0); vector i2l(len, 0); ...
分类:
其他好文 时间:
2014-07-22 22:34:54
阅读次数:
154