摘要:
Given n integers. You have two operations: U A B: replace the Ath number by B. (index counting from 0) Q A B: output the length of the longest consecu 阅读全文
摘要:
You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of in 阅读全文
摘要:
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Ea 阅读全文
摘要:
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number 阅读全文
摘要:
For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultim 阅读全文
摘要:
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生 阅读全文
摘要:
题解:根据唯一分解定理,设唯一分解式 n=a1p1 ......,不难发现每个a1p1作为单独的一个整数时最优。 注意:①n=1时,ans=2;②n只有一个因子时需要加个1③n=231-1时不要溢出 阅读全文
摘要:
待理解,待重做 阅读全文
摘要:
题解:所有计算都是对n取模的,不妨设F(i) = f(i) mod n。不难发现,当二元组(F(i),F(i+1))出现重复时,整个序列就开始重复。因为余数最多 n种,所以最多n2 项就会出现重复。设周期为M,则只需要计算出F[0]~F[n2],然后算出F[ab]等于其中哪一项就可以了。 摘自《算法 阅读全文