题意:给你一组数a[n],求满足a[i] < a[k] < a[j] (i <= k <= j)的最大的 j - i . 析:在比赛时,我是暴力做的,虽然错了好多次,后来说理解是rmq,我又用rmq写了一次,发现rmq还没有我暴力快,rwq 2000多,暴力才700. 暴力中加了一个优化条件就是前枚举 i 时,下一个 i 值不一定是i+1,而是满足条件中的最大值的位置.这样优化就是时间很短了. 如果用rmq,就得用两个dp数组分别记录最大值和最小值的下标,然后枚举 i,在i+1 -…
RMQ+二分....枚举 i ,找比 i 小的第一个元素,再找之间的第一个最大元素..... Sticks Problem Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 9338 Accepted: 2443 Description Xuanxuan has n sticks of different length. One day, she puts all her stick…
Interviewe Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6722 Accepted Submission(s): 1592 Problem Description YaoYao has a company and he wants to employ m people recently. Since his compa…
Interviewe Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4543 Accepted Submission(s): 1108 Problem Description YaoYao has a company and he wants to employ m people recently. Since his compa…
Get Luffy Out Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8851 Accepted: 3441 Description Ratish is a young man who always dreams of being a hero. One day his friend Luffy was caught by Pirate Arlong. Ratish set off at once to Arlo…
Assignment Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 557 Accepted Submission(s): 280 Problem Description Tom owns a company and he is the boss. There are n staffs which are numbered fr…