ural1613 For Fans of Statistics
For Fans of Statistics
Memory limit: 64 MB
Input
Output
Sample
input | output |
---|---|
5 |
10101 |
分析:map+二分;
代码:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define rsp(it,s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
const int maxn=1e5+;
const int dis[][]={{,},{-,},{,-},{,}};
using namespace std;
ll gcd(ll p,ll q){return q==?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=;while(q){if(q&)f=f*p;p=p*p;q>>=;}return f;}
int n,m,k,t;
string ans;
map<int,set<int> >a;
set<int>::iterator it;
int main()
{
int i,j;
scanf("%d",&n);
rep(i,,n)scanf("%d",&j),a[j].insert(i);
int q;
scanf("%d",&q);
while(q--)
{
int l,r,p;
scanf("%d%d%d",&l,&r,&p);
if((it=a[p].lower_bound(l))!=a[p].end()&&*it<=r)
ans+='';
else ans+='';
}
cout<<ans<<endl;
//system("pause");
return ;
}
ural1613 For Fans of Statistics的更多相关文章
- STL--G - For Fans of Statistics(两个推断条件-二分)
G - For Fans of Statistics Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & ...
- 1613. For Fans of Statistics(STL)
1613 高端的东西 lower_bounder 函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置.如果所有元素都小于val,则返 ...
- ural 1613 For Fans of Statistics
#include <cstdio> #include <cstring> #include <map> #include <vector> #inclu ...
- A过的题目
1.TreeMap和TreeSet类:A - Language of FatMouse ZOJ1109B - For Fans of Statistics URAL 1613 C - Hardwood ...
- AC题目简解-数据结构
A - Japan POJ 3067 要两条路有交叉,(x1,y1)(x2,y2)那么需要满足:(x1-x2)*(y1-y2)<0判断出这是求逆序的问题 树状数组求逆序,先通过自定义的比较器实 ...
- ABBA BABA statistics
The ABBA BABA statistics are used to detect and quantify an excess of shared derived alleles, which ...
- SQL Server 的 Statistics 簡介
當你要清空「資料表(table)」,或倒入大量「資料(data;record)」,或公司「資料庫(database)」改用新版本要資料大搬家…等情形,不只是要重建「索引(index)」,還應要重建或更 ...
- SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色 SP2-0611: 启用 STATISTICS 报告时出错
援引: SP2-0618: 无法找到会话标识符.启用检查 PLUSTRACE 角色 SP2-0611: 启用 STATISTICS 报告时出错 问题描述及解决方法: SQL*Plus: Release ...
- Spark MLlib 之 Basic Statistics
Spark MLlib提供了一些基本的统计学的算法,下面主要说明一下: 1.Summary statistics 对于RDD[Vector]类型,Spark MLlib提供了colStats的统计方法 ...
随机推荐
- java 集合中将元素倒序排列
方法一:实现Comparable接口排序package collsort.comparable; package com.cvicse.sort.comparable; public class Ca ...
- eclipse添加桌面快捷方式
linuxmint系统 输入sudogedit /usr/share/applications/eclipse.desktop,在打开的文件中输入以下参数: [Desktop Entry] Encod ...
- JSP导出Excel后身份证后三位为0
JSP导出Excel身份证号码超出Excel最大限制,用科学计数法表示,但后三位为0,修改方式: <style type="text/css">.txt { ...
- redis 进阶
1.一定要设置最大缓存大小并设置缓存策略 如果不设置最大缓存,在新添加数据时,如果超过最大内存回事redis崩溃! 设置方式:maxmemory 1GB 使用redis-cli登录后,使用info命令 ...
- junit 单元测试 - 参数化测试
junit4.x版本需要引入如下jar包: hamcrest-core-1.3.jar junit-4.12-beta-3.jar 新建一个计算器类,如下: package com.pt; publi ...
- zf-关于评价器的开关所在的配置文件,与代码如何修改。
web.xml文件 把true改成false就是关
- 【jsp网站计数功能】 application session
在jsp页面中实现网站计数器的方法有很多,其中比较普遍的做法是利用application 和session对象.application对象可被所有用户共享:session是单用户共享,用户从访问系统开 ...
- oracle数据库的一次异常起停处理。
在重启数据库的时候,忘记把一个应用关停了,想起来的时候,就ctrl+c,把数据库shutdown immediate 给强制停下了,把该应用再停止,然后shutdown immdiate,这时候数据报 ...
- php ajax 下拉加载数据
视图 <html> <head> <title>健康知识</title> <script type="text/javascript&q ...
- div里面的margin-top失效
div标签中的元素margin-top失效的解决方法 元素上级标签是div,已经设置了width和height等的属性,可是,在对元素使用margin进行调整的时候,无法生效,下面有个不错的解决方法, ...