水题 学习一下数据的存储方法。

 #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<vector>
#include<map>
using namespace std;
int n,m;
map<int,vector<int> >a; int main()
{
while(~scanf("%d%d",&n,&m))
{
for(int i=;i<n;i++)
{
int x;
scanf("%d",&x);
if(!a.count(x))
a[x]=vector<int>();
a[x].push_back(i+);
}
while(m--)
{
int x,y;
scanf("%d%d",&x,&y);
if(a[y].size()<x||!a.count(y))
printf("0\n");
else
printf("%d\n",a[y][x-]);
}
}
return ;
}

uva 11991 Easy Problem from Rujia Liu? vector+map的更多相关文章

  1. uva 11991 - Easy Problem from Rujia Liu?(STL)

    option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142" target="_blank ...

  2. CJOJ 2485 UVa 11991 生日礼物 / UVa 11991 Easy Problem from Rujia Liu?

    CJOJ 2485 UVa 11991 生日礼物 / UVa 11991 Easy Problem from Rujia Liu? Description (原题来自刘汝佳<训练指南>Pa ...

  3. [UVA] 11991 - Easy Problem from Rujia Liu? [STL应用]

    11991 - Easy Problem from Rujia Liu? Time limit: 1.000 seconds Problem E Easy Problem from Rujia Liu ...

  4. UVa 11991:Easy Problem from Rujia Liu?(STL练习,map+vector)

    Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, ...

  5. UVA 11991 Easy Problem from Rujia Liu?(vector map)

    Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, ...

  6. UVA 11991 Easy Problem from Rujia Liu?【STL】

    题目链接: option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142">https://uv ...

  7. STL UVA 11991 Easy Problem from Rujia Liu?

    题目传送门 题意:训练指南P187 分析:用vector存id下标,可以用map,也可以离散化用数组存(发现不用离散化也可以) map #include <bits/stdc++.h> u ...

  8. 11991 - Easy Problem from Rujia Liu?(的基础数据结构)

    UVA 11991 - Easy Problem from Rujia Liu? 题目链接 题意:给一个长度n的序列,有m询问,每一个询问会问第k个出现的数字的下标是多少 思路:用map和vector ...

  9. uva--11991 - Easy Problem from Rujia Liu?(sort+二分 map+vector vector)

    11991 - Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for e ...

随机推荐

  1. 10+ 最流行的 jQuery Tree 菜单插件

    jstree – jQuery Tree Plugin With HTML & JSON Data jstree is a lightweight and flexible jQuery pl ...

  2. uva 1377

    比较不错的一个题,关键是理解状态转移 #include<algorithm> #include<cstdio> #include<cstring> #include ...

  3. KafkaSpout分析:配置

    public KafkaSpout(SpoutConfig spoutConf) { _spoutConfig = spoutConf;} 基于0.93版本的Storm SpoutConfig继承自K ...

  4. Unity3D接入移动MM支付SDK(强联网)的问题

    原地址:http://blog.csdn.net/lihandsome/article/details/11919113 因为移动MM支付的SDK只提供android版本的,要自己写过一个androi ...

  5. POJ 3786 Adjacent Bit Counts (DP)

    点我看题目 题意 :给你一串由1和0组成的长度为n的数串a1,a2,a3,a4.....an,定义一个操作为AdjBC(a) = a1*a2+a2*a3+a3*a4+....+an-1*an.输入两个 ...

  6. Mac OS X 启用 Web 服务器

    转载: http://note.rpsh.net/posts/2013/11/26/osx-apache-server-php-mysql/

  7. libevent学习之二:Windows7(Win7)下编译libevent

    Linux下编译参考源码中的README文件即可,这里主要记录Windows下的编译. 一.准备工作 去官网下载最新的稳定发布版本libevent-2.0.22-stable 官网地址:http:// ...

  8. Tomcat 部署Undeployment Failure

    Tomcat 部署Undeployment Failure - yongjava的日志 - 网易博客 http://blog.163.com/qiangyongbin2000@126/blog/sta ...

  9. ArcGIS Runtime for Android开发教程V2.0(1)基本概念

    原文地址: ArcGIS Runtime for Android开发教程V2.0(1)基本概念 - ArcGIS_Mobile的专栏 - 博客频道 - CSDN.NET http://blog.csd ...

  10. SGU128 Snake

    SGU128,题意是给定N个点,问说能不能形成一个闭环G,要求G经过每个点,且在每个点处都有90度的转角,且不能出现自交. 没想出来,通过这提供的思路,由于每个点处都需要90度的转弯,因此每个点处必然 ...