1.http://blog.csdn.net/dyx404514/article/details/39122743 思路:题目意思很清楚了,这里只说思路. 设区间[L,R],区间长度为len=(R-L+1),设F[i]表示G(i,i)+G(i,i+1)+......G(i,R).那么对于区间[L,R],询问的答案即为Ans[L,R]=F[L]+F[L+1]+......+F[R].容易得到G[i,j]=Si-G(i+1,j),所以F[i]=(R-i+1)*Si-F[i+1].即F[i]+F[i+…
2019-ACM-ICPC-徐州站网络赛-M.Longest subsequence-从字符串s中找到一个最长子序列,使得其字典序严格大于t [Problem Description] ​ 从字符串\(s\)中找到一个最长子序列,使得其字典序严格大于\(t\). [Solution] ​ 对于答案字符串来说,一定是和\(t\)串的前面部分一致,从一个字母开始比\(t\)的字符大,以后的字符就都取上就行了.从前到后扫描\(s\)串,同时用一个数组\(sum[26]\)维护\(t\)中字母最后出现的…
2019-ACM-ICPC-徐州站网络赛- I. query-二维偏序+树状数组 [Problem Description] ​ 给你一个\([1,n]\)的排列,查询\([l,r]\)区间内有多少对\((i,j)\)满足\(l\le i<j\le r\),且\(min(p_i,p_j)=gcd(p_i,p_j)\). [Solution] ​ 将所有询问按区间右端点从小到大排序,对于排序后的每一个询问,将\([1,r]\)中所有满足条件的插入到树状数组中,然后查询区间大小即可.(\([1,r]…
Average Score Time Limit: 2 Seconds      Memory Limit: 65536 KB Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis. After a mid-term exam, Bob was anxious about his…
Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy. Entropy is t…
Known Notation Time Limit: 2 Seconds      Memory Limit: 65536 KB Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expres…
Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboar…
1.题目描写叙述:点击打开链接 2.解题思路:本题是四色定理的模板题.只是有几种情况要提前特判一下:n==1直接输出,1<n<5时候无解,n==6时候套用模板会出现同样的块.因此要特判一下.其它情况都能直接利用模板构造出来. 3.代码: #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<cassert> #include<string>…
Untrusted Patrol Time Limit: 3 Seconds                                     Memory Limit: 65536 KB                             Edward is a rich man. He owns a large factory for health drink production. As a matter of course, there is a large warehouse…
1.题目描写叙述:点击打开链接 2.解题思路:本题是一道隐式图的搜索题目.一般来说,这类题目首先要定义状态,接下来是弄清楚状态怎样转移,以及状态怎样判重,怎样推断当前状态是否和目标状态同样.至于求解最短路就是经常使用的BFS就可以. 接下来我们逐一展开讨论. 1.状态的定义:看到这道题,猛一下会想着把每一个字符分别用01表示,然后看成二进制码进行状态压缩,这个状态定义尽管能够,可是显然,状态过于精确和复杂,假设把一行给压缩成一个整数,那么一个完整的图案要用8*9.即72个数才干描写叙述.显然过于…