A. Splits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's define a split of n as a nonincreasing sequence of positive integers, the sum of which is n. For example, the following seque…
A. Alternating Sum 就是个等比数列,特判公比为 $1$ 的情况即可. #include <bits/stdc++.h> using namespace std; ; ; ) { ; while (b) { ) ans = 1LL * ans * a % MOD; a = 1LL * a * a % MOD; b >>= ; } return ans; } int M(int a) { ) a += MOD; if (a >= MOD) a -= MOD; r…
2018-02-19 A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a string A. Find a string B, where B is a palindrome and A is a subsequence of B. A su…
思路:把边看成点,然后每条边只能从下面的边转移过来,我们将边按照u为第一关键字,w为第二关键字排序,这样就能用线段树维护啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int,int> using namespace std; ; + ; const int inf = 0x3f3f3f3f…
靠这把上了蓝 A. Palindromic Supersequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a string A. Find a string B, where B is a palindrome and A is a subsequence of B. A subseq…
C. Permutation Cycle time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output For a permutation P[1... N] of integers from 1 to N, function f is defined as follows: Let g(i) be the minimum positi…