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的统计方法 ...
随机推荐
- As3.0 Interface 与类的使用
来源:http://blog.sina.com.cn/s/blog_4d65c19e0100bfkb.html 抽象类:又叫抽象基类:可以包含一般类所包含的所有特性,例如,字段,属性,方法,抽象类不能 ...
- myeclipse8.6安装svn插件
1.从官方网站下载site-1.6.16.zip,网址:subclipse.tigris.org: 2.将解压出来的features与plugins,复制到任意目录:Genuitec/MyEclips ...
- linux 常用端口
常用端口 下面的表格中列举了包括在红帽企业 Linux 中的服务.守护进程.和程序所使用的最常见的通信端口.该列表还可以在 /etc/services 文件中找到.要查看由互联网号码分派局(IANA) ...
- E212:无法打开并写入文件
用vi编辑文件是 老师出现这样的错误 有些文件 需要root权限才能修改 切换成root权限就行了
- Openlays 3 绘制基本图形
<body> <div id="menu"> <label>几何图形类型:</label> <select id=" ...
- PHP配置安全小技巧
- 内联函数 inline 漫谈
内联函数存在的结论是: 引入内联函数是为了解决函数调用效率的问题 由于函数之间的调用,会从一个内存地址调到另外一个内存地址,当函数调用完毕之后还会返回原来函数执行的地址.函数调用会有一定的时间开销,引 ...
- 使用devcon禁用启用网卡
系统平台:win2003 情况描述: 机器上装有两块网卡,8136和8139,网卡A使用静态IP,连接内部办公网,网卡B使用DHCP,连接互联网.切换两个网络时,需要先禁用一个网卡,启用另一个网卡.来 ...
- 《CSS设计指南》阅读笔记
一.HTML实体 HTML实体常用于生成那些键盘上没有的印刷字符.以一个和号(&)开头,一个分号(:)结尾,二者之间是表示实体的字符串. 如:“左引号(") ”右引号(&qu ...
- windows程序设计学习笔记(一)
windows里的变量类型 1.简单重定义windows变量 BOOL (TRUE FALSE) INT UINT(32位,4字节) LONG DWORD(32位,4字节) lParam,wParam ...