Codeforces Round #215 (Div. 2) B. Sereja and Suffixes
#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);
for(int i = ; i < n ; ++ i)
cin >>a[i];
for(int i = ; i < m; ++ i)
cin >>l[i];
set<int> diff;
vector<int> res(n,);
for(int i = n-;i >=; -- i){
diff.insert(a[i]);
res[i] = diff.size();
}
for(int i = ; i< m; ++ i){
cout<<res[l[i]-]<<endl;
}
return ;
}
Codeforces Round #215 (Div. 2) B. Sereja and Suffixes的更多相关文章
- Codeforces Round #215 (Div. 2) B. Sereja and Suffixes map
B. Sereja and Suffixes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
- Codeforces Round #215 (Div. 1) B. Sereja ans Anagrams 匹配
B. Sereja ans Anagrams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
- Codeforces Round #215 (Div. 2) D. Sereja ans Anagrams
http://codeforces.com/contest/368/problem/D 题意:有a.b两个数组,a数组有n个数,b数组有m个数,现在给出一个p,要你找出所有的位置q,使得位置q q+ ...
- Codeforces Round #215 (Div. 2) C. Sereja and Algorithm
#include <iostream> #include <vector> #include <algorithm> #include <string> ...
- Codeforces Round #215 (Div. 2) A. Sereja and Coat Rack
#include <iostream> #include <vector> #include <algorithm> using namespace std; in ...
- Codeforces Round #246 (Div. 2) D. Prefixes and Suffixes
D. Prefixes and Suffixes You have a string s = s ...
- Codeforces Round #223 (Div. 2) E. Sereja and Brackets 线段树区间合并
题目链接:http://codeforces.com/contest/381/problem/E E. Sereja and Brackets time limit per test 1 secon ...
- Codeforces Round #215 (Div. 2) D题(离散化+hash)
D. Sereja ans Anagrams time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces Round #215 (Div. 1)
A Sereja and Algorithm 题意:给定有x,y,z组成的字符串,每次询问某一段s[l, r]能否变成变成zyxzyx的循环体. 分析: 分析每一段x,y,z数目是否满足构成循环体,当 ...
随机推荐
- Spring学习笔记—最小化Spring XML配置
自动装配(autowiring)有助于减少甚至消除配置<property>元素和<constructor-arg>元素,让Spring自动识别如何装配Bean的依赖关系. 自动 ...
- 【JAVA多线程问题之死锁】
一.死锁是什么? 举个例子:两个人一起吃饭,每个人都拿了一只筷子,双方都在等待对方将筷子让给自己,结果两个人都吃不了饭.这种情况和计算机中的死锁情况很相似. 假设有两个线程,互相等待对方释放占有的锁, ...
- 团队作业-第一周-NABCD竞争性需求分析
1. Need 需求 随着科技信息的发展,传统的课堂点名亟待步入信息处理的轨道,移动校园课堂点名软件恰好的切入了这个需求点,市场中词类软件也为数不多,因此需求也是比较强烈. 2. Approac ...
- memcache(使用php操作memcache)
.概念 memcache 是一个高效的分布式的内存对象缓存系统,他可以支持把php的各种数据(数组,对象,基本数据类型)放在它管理的内存中 . 安装步骤 1.下载php_memcache.dll文件并 ...
- hdu 4055 递推
转自:http://blog.csdn.net/shiqi_614/article/details/7983298 题意:由数字1到n组成的所有排列中,问满足题目所给的n-1个字符的排列有多少个,如果 ...
- I帧 B帧 p帧 IDR帧的区别
转自:http://blog.csdn.net/sphone89/article/details/8086071 IDR(Instantaneous Decoding Refresh)--即时解码刷新 ...
- NuGet学习笔记(2) 使用图形化界面打包自己的类库
上文NuGet学习笔记(1) 初识NuGet及快速安装使用说到NuGet相对于我们最重要的功能是能够搭建自己的NuGet服务器,实现公司内部类库的轻松共享更新.在安装好NuGet扩展后,我们已经能够通 ...
- MySQL5.7中新增的JSON类型的使用方法
创建表json_test: CREATE TABLE json_test(id INT(11) AUTO_INCREMENT PRIMARY KEY,person_desc JSON)ENGINE I ...
- HeapSort自己yy-未完成
#include <iostream> #include <cstdio> using namespace std; ; int a[maxn]; int HeapSize; ...
- 从两个平方算法到分治算法-java
先来看看问题的来源,假设有这么一个数组: 1 2 -5 4 -2 3 -3 4 -15 我们要求出其中连续字数组的和的最大值 例如这么可以很明显看出 4+ –2 + 3 + –3 + 4 = 6 所有 ...