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年西安...

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...
阅读全文 0

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...
阅读全文 0

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]为回文串。两...
阅读全文 0

Vijos P1987 – 游戏 [贪心]


Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于a且不大于b的整数t,并告诉小可可这个数字t是多少。之后小可可会挑出恰好k张卡片,并将这k张卡片上的数字相...

Vijos P1987 – 游戏 [贪心]

Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于...
阅读全文 0

Vijos P1988 – 自行车比赛 [贪心]


Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计得分决出冠军。今年一共有N位参赛选手。每一天的比赛总会决出当日的排名,第一名的选手会获得N点得分,第二...

Vijos P1988 – 自行车比赛 [贪心]

Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0

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...
阅读全文 0