#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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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+ ...

  4. Codeforces Round #215 (Div. 2) C. Sereja and Algorithm

    #include <iostream> #include <vector> #include <algorithm> #include <string> ...

  5. Codeforces Round #215 (Div. 2) A. Sereja and Coat Rack

    #include <iostream> #include <vector> #include <algorithm> using namespace std; in ...

  6. Codeforces Round #246 (Div. 2) D. Prefixes and Suffixes

                                                        D. Prefixes and Suffixes You have a string s = s ...

  7. 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 ...

  8. 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 ...

  9. Codeforces Round #215 (Div. 1)

    A Sereja and Algorithm 题意:给定有x,y,z组成的字符串,每次询问某一段s[l, r]能否变成变成zyxzyx的循环体. 分析: 分析每一段x,y,z数目是否满足构成循环体,当 ...

随机推荐

  1. C#的事件

    using System; using System.Collections; using System.Collections.Generic; using System.IO; namespace ...

  2. 比较各大挪动门户网站淘宝、京东、网易、新浪、腾讯meta标签的异同

    首先先展示一下各个网站的有关meta标签的代码: 网易 <meta charset="UTF-8"> <meta content="width=devi ...

  3. 【转载】pyqt QTableWidget的使用

    转载地址: http://blog.sina.com.cn/s/blog_9b78c91101019sgi.html QTableWidget是QT程序中常用的显示数据表格的空间,很类似于VC.C#中 ...

  4. JetBrains发布了IntelliJ IDEA 2016.1

    JetBrains日前发布了IntelliJ IDEA 2016.1,即他们最受欢迎的IDE的最新版本.这个新版本应该是考虑了多语言开发者的需求,其在许多语言和技术都有很多的增强:然而最惹人注目的变化 ...

  5. java BigInteger使用

    虽然说我不怎么会用java写一些东西,但是java里的biginteger我还是很喜欢的.这个类解决了,我们在其他很多语言中遇到的问题:大数.比如在C++中我们要计算一个大小超过long long的数 ...

  6. linux命令执行返回值(附错误对照表)

    转自:http://blog.sina.com.cn/s/blog_6739945f0100zt4b.html 在 Linux 下,不管你是启动一个桌面程序也好,还是在控制台下运行命令,所有的程序在结 ...

  7. 第八篇:SOUI中控件事件的响应

    SOUI中提供了大部分常用的win32标准控件的实现,如pushbutton, checkbox, radiobox, edit, richedit, listbox, combobox, treec ...

  8. ML 06、感知机

    机器学习算法 原理.实现与实践  —— 感知机 感知机(perceptron)是二分类的线性分类模型,输入为特征向量,输出为实例的类别,取值+1和-1.感知机学习旨在求出将训练数据进行线性划分的分离超 ...

  9. HTML概况性介绍

    HTML(HyperText Markup Language)汉语的意思是:超文本标记语言. ”超文本”是指.html页面内不仅仅可以包含文字,还可以包含图片.链接,甚至音乐.程序等非文字元素. “标 ...

  10. 【hibernate criteria】hibernate中criteria的完整用法 转

    ---恢复内容开始--- 转自:http://www.360doc.com/content/090313/10/26262_2794855.html 1.Criteria Hibernate 设计了 ...