题目大意: 我们有一个集合 S,其中包含了 m 个不完全相同的区间[l1,r1],[l2,r2]…[lm,rm] (1≤li≤ri≤n,li,ri 都为整数). 定义 f(S)=k,表示集合 S 中能取出最多 k 个区间,使得这 k 个区间两两不相交. 问当 f(S)=k 时,符合条件的集合 S 有多少个. 思路: f[i][j]表示集合S中所有区间的端点均小于等于i且f(S)=j的集合S的个数. 显然i≥j,则f[i][j]由f[k][j-1](j-1≤k≤i)转移而来,新的与之前区间不相交的…
discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). Then Sereja marked each point with a small or large English letter. Sereja don't like letter "x", so he didn't use it to mark points. Sereja thi…
Sereja has a sequence that consists of n positive integers, a1, a2, ..., an. First Sereja took a piece of squared paper and wrote all distinct non-empty non-decreasing subsequences of sequence a. Then for each sequence written on the squared paper, S…
Sereja and Cinema 首先我们可以发现除了第一个人, 其他人都会坐在已入坐人的旁边. 难点在于计算方案数.. 我们可以从外往里把确定的人用组合数算上去,然后缩小范围. #include<bits/stdc++.h> #define LL long long #define LD long double #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #de…
CodeForces 3 67E (109 + 7). Two ways are considered distinct if there is such j(1 ≤ j ≤ n), that the j-th intervals in two corresponding sequences are not equal. (109 + 7);;][MAX][MAX]; { ) { memset(dp,, dp[][][]=; …
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a set Y of n distinct positive integers y1, y2, -, yn. Set X of n distinct positive integers x1, x2, -, xn is said to generate set…
题目: A. Sereja and Prefixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algor…