#include<bits/stdc++.h>using namespace std;int n,x;char s[10010];char a[31010];int val[100010];int ch[100010][30];int dp[100010];int main(){    while(~scanf("%d",&n))    {        scanf("%s",s+1);        int len=strlen(s+1);  …
Time limit 1000 ms Memory limit 131072 kB It is widely known that any two strangers can get to know each other through at most six other people. Now let’s prove this. In the country Intermediary Conducts Personal Communications (ICPC), there are up t…
Time limit 1000 ms Memory limit 131072 kB Little A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Little B is his elder, younger or brother.   Input There a…
题意 给一个\(n\)的全排列数组\(a\),求一个递推数组每一项的值:\(ans[i]=ans[j]+1\),\(j\)为\(a[pos[i]-k]到a[pos[i]+k],(pos[i]为i在数组a中的下标)\)中小于\(i\)的最大的值. 分析 这题set的做法更优秀,但是想练习一下在主席树上二分. 按权值建主席树,对每个\(i\)去查询\(a[pos[i]-k]到a[pos[i]+k]\)中小于\(i\)的最大值,查询时先查询右儿子,再查询左儿子,因为找到的右儿子一定比左儿子大,直到找到…
Time limit 1000 ms Memory limit 131072 kB The life of Little A is good, and, he managed to get enough money to run a hotel. The best for him is that he need not go to work outside, just wait for the money to go into his pocket. Little A wants everyth…
Largest Rectangle in a Histogram Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21204   Accepted: 6831 Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal wi…
Time limit 1000 ms Memory limit 131072 kB This English game is a simple English words connection game. The rules are as follows: there are N English words in a dictionary, and every word has its own weight v. There is a weight if the corresponding wo…
Time limit  1000 ms Memory limit  131072 kB Little A has became fascinated with the game Dota recently, but he is not a good player. In all the modes, the rdsp Mode is popular on online, in this mode, little A always loses games if he gets strange he…
Time limit  1000 ms Memory limit  131072 kB The National Intelligence Council of X Nation receives a piece of credible information that Nation Y will send spies to steal Nation X’s confidential paper. So the commander of The National Intelligence Cou…
Time limit   1000 ms Memory limit   131072 kB Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the digital clock.   In…