cf B. Sereja and Suffixes】的更多相关文章

http://codeforces.com/contest/368/problem/B 从后往前找一遍就可以. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 200000 using namespace std; int dp[maxn]; int n,m; int a[maxn]; bool vis[maxn]; int main() { while(scanf("…
http://codeforces.com/problemset/problem/368/B B. Sereja and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja has an array a, consisting of n integers a1, a2, ..., an. The bo…
B. Sereja and Suffixes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/368/B Description Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an…
Sereja and Suffixes Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an arr…
B. Sereja and Suffixes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to stud…
#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; int main(){ int n,m; cin >> n >>m; vector<int> a(n),l(m); ; i < n ; ++ i) cin >>a[i]; ; i < m; ++ i) cin &…
题目链接:http://codeforces.com/problemset/problem/314/C 题意:给定一个数列a.(1)写出a的不同的所有非下降子列:(2)定义某个子列的f值为数列中各个数的乘积.(3)求所有非下降子列的f值之和. 思路:我们用s[i]表示以数字a[i]结尾的所有非下降子列的f之和.那么a必然是接在之前小于等于a的某个数之后,设这个位置为j,那么s[i]=(s[j]+1)*a[i].也就是,a[i]可以接在其后或者自成一个子列.那么最后的答案就是所有的s值之和.这里有…
题意:给你一个序列,问你从l位置到结尾有多少个不同的数字. 水题,设dp[i]表示从i位置到结尾不同数字的个数,那么dp[i] = dp[i+1] + (vis[a[i]] == 0),在O(n)时间内得出答案. #include<cstdio> #include<string> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const…
Codeforces Round #215 (Div. 2) B:http://codeforces.com/problemset/problem/368/B 题意:给你一个序列,然后查询i--n中没有重复元素的个数. 题解:从右到左递推一遍可以了,很简单的递推. #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ; i…
http://codeforces.com/contest/368/problem/D #include <cstdio> #include <cstring> #include <map> #include <vector> #include <algorithm> #define maxn 300000 #define LL long long using namespace std; int n,m,p; LL a[maxn],b[maxn…