Codeforces 17.E Palisection】的更多相关文章

E. Palisection time limit per test 2 seconds memory limit per test 128 megabytes input standard input output standard output In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We should remin…
Codeforces 17 E 题意:给一个串,求其中回文子串交叉的对数. 思路1:用哈希解决.首先求出每个点左右最长的回文串(要分奇数长度和偶数长度),然后记录经过每个点的回文串的个数,以及它们是在回文串的前半段还是后半段(代表着对于当前节点这个回文串是刚刚覆盖到它还是将要消亡),然后到每个节点的时候将新经过当前这个节点的回文串两两配对,并且将经过当前这个节点但没有消亡的回文串与新经过当前这个节点的回文串配对,更新经过当前节点的回文串. 思路2:用回文树解决.在回文树中记录在每个节点结束的回文…
C. Balance 题目链接 http://codeforces.com/contest/17/problem/C 题面 Nick likes strings very much, he likes to rotate them, sort them, rearrange characters within a string... Once he wrote a random string of characters a, b, c on a piece of paper and began…
A - Noldbach problem 题面链接 http://codeforces.com/contest/17/problem/A 题面 Nick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nic…
Codeforces 17E Palisection E. Palisection In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We should remind you that a string is called a palindrome if it can be read the same way both from…
Codeforces Beta Round #17 题目链接:点击我打开题目链接 大概题意: 给你 \(b\),\(n\),\(c\). 让你求:\((b)^{n-1}*(b-1)\%c\). \(2<=b<=10^{10^6},1<=n<=10^{10^6},1<=c<=10^9\) 简明题解: 因为 \(b\) , \(n\)都太大了.关键是求 \((b)^{n-1}\%c\) 所以,我们可以利用欧拉函数 \(phi()\) 的性质. 对于\(a^{b} \% c\…
Educational Codeforces Round 17 A. k-th divisor 水题,把所有因子找出来排序然后找第\(k\)大 view code //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function<voi…
题目传送门 传送点I 传送点II 传送点III 题目大意 给定一个串$s$询问,有多少对回文子串有交. 好像很简单的样子. 考虑能不能直接求,感觉有点麻烦.因为要考虑右端点在当前回文子串内还有区间包含问题. 那么考虑补集转化.问题转化成,考虑当前的回文串,之前有多少个回文串与它不相交. 跑一遍Manacher.然后先差分再二阶前缀和求出以第$i$个位置为右端点的回文子串的个数.然后再求一次前缀和就可以了. 然后再扫一遍就做完了. Code /** * Codeforces * Problem#1…
E. Palisection time limit per test 2 seconds memory limit per test 128 megabytes input standard input output standard output In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We should remin…
又被虐了... (记一次惨痛的Codeforces) 好不容易登上去了Codeforces,22:35准时开打 第一题,一看:这不SB题嘛?直接枚举因数上啊.9min才过掉了pretest 第二题... ... 什么鬼东西??? 写了个网络流上去 TLE 看来我还是太天真了 第三题呢? 貌似是个dp,不会... 剩下的没心情看了...然后老妈催我睡觉. 于是我一觉睡到了七八点 躺床上,我不甘心又去想B题,发现好像...直接贪心模拟可做!!! 立马爬了起来去码,测样例才发现刚刚想的做法没有考虑到每…