UVALive 7040 / Gym 100548F – Color [容斥+数论]

Link https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5052 Mean 有N个格子，现有M种颜色，对这些格子涂色，相邻两个格子不能同色。问恰好用上K种颜色的涂色方法有多少种。 Analysis 14年西安...

HDU 1664 – Different Digits [数论+暴力BFS]

Link http://acm.hdu.edu.cn/showproblem.php?pid=1664 Problem Given a positive integer n, your task is to find a positive integer m, which is a multiple of n, and that m contains the least number of different digits when represented in decimal. For ...

HDU 1664 – Different Digits [数论+暴力BFS]

Link http://acm.hdu.edu.cn/showproblem.php?pid=1664 Problem Given a positive integer n, your task is to find a positive integer m, which is a multi...

Gym 100548G / UVALive 7041 – The Problem to Slow Down You [回文自动机]

Link http://codeforces.com/gym/100548/attachments Mean 给你两个字符串s1和s2，求有多少个四元组(a, b, x, y)使得s1[a:b]==s2[x:y]且s1[a:b]为回文串。两串长度最长均为2e5. Analysis 比赛时用后缀数组+Manacher+RMQ+主席树瞎凑…最后还是没搞出来… 这...

Gym 100548G / UVALive 7041 – The Problem to Slow Down You [回文自动机]

Link http://codeforces.com/gym/100548/attachments Mean 给你两个字符串s1和s2，求有多少个四元组(a, b, x, y)使得s1[a:b]==s2[x:y]且s1[a:b]为回文串。两...

HDU 2340 – Obfuscation [DP]

Link http://acm.hdu.edu.cn/showproblem.php?pid=2340 Problem It is a well-known fact that if you mix up the letters of a word, while leaving the first and last letters in their places, words still remain readable. For example, the sentence “tihs sn...

HDU 2340 – Obfuscation [DP]

Link http://acm.hdu.edu.cn/showproblem.php?pid=2340 Problem It is a well-known fact that if you mix up the letters of a word, while leaving the fir...

HDU 5880 – Family View [AC自动机]

Link http://acm.hdu.edu.cn/showproblem.php?pid=5880 Problem Steam is a digital distribution platform developed by Valve Corporation offering digital rights management (DRM), multiplayer gaming and social networking services. A family view can help...

HDU 5880 – Family View [AC自动机]

Link http://acm.hdu.edu.cn/showproblem.php?pid=5880 Problem Steam is a digital distribution platform developed by Valve Corporation offering digita...

URAL 2060 – Subpalindrome pairs [Manacher+树状数组]

Link http://acm.timus.ru/problem.aspx?space=1&num=2060 Problem Your task is to calculate number of triplets (i, j, k) such that i ≤ j < k and s[i..j] is a palindrome and s[j+1 .. k] is a palindrome. Mean 给一个最长为300000的字符串s，问有多...

URAL 2060 – Subpalindrome pairs [Manacher+树状数组]

Link http://acm.timus.ru/problem.aspx?space=1&num=2060 Problem Your task is to calculate number of triplets (i, j, k) such that i ≤ j < k an...

URAL 1713 – Key Substrings [后缀数组+RMQ]

Link http://acm.timus.ru/problem.aspx?space=1&num=1713 Problem Although the program committee works as one team, heated debates arise frequently enough. For example, there is no agreement upon which client of the version control system is mor...

URAL 1713 – Key Substrings [后缀数组+RMQ]

Link http://acm.timus.ru/problem.aspx?space=1&num=1713 Problem Although the program committee works as one team, heated debates arise frequent...