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的统计方法 ...
随机推荐
- easyui 动态渲染
$.parser.parse 这个 $("div[data-easyuisrc]").html(function () { var url = $(this).attr(&qu ...
- 网站网址前的小logo
认识网页前小图标 1.能在浏览器标签.地址栏左边和收藏夹栏显示小图标的网站,其网站都是使用了其名称为"favicon.ico"图标文件,格式为ico格式,图标大小一般为16*16, ...
- [分享]Host文件的原理解释及应用说明
Host文件的原理解释及应用说明 Host文件位置及打开方式: Window系统中有个Hosts文件(没有后缀名), Windows 98系统下该文件在Windows目录,在Windows 2 ...
- # 泰语字符串字符分割 --- UTF-8编码格式
1.泰语编码格式 泰语用的编码格式是:ISO 8859-11,这个是Latin编码系列,是从"ISO-8859-1"发展过来的,采用的是8bit一个字,所以泰语中的英文字母或者数字 ...
- Spring Boot 系列教程13-注解定时任务
注解 @Scheduled(cron = "0/5 * * * * ?") 相当于原来的xml版本的如下配置 <task:scheduled ref="schedu ...
- Setting DPDK+OVS+QEMU on CentOS
Environment Build Step: these packages are needed for building dpdk+ovs: yum install -y make gcc gli ...
- webservice(soap)接口的加密,SHA-1实现
import java.io.UnsupportedEncodingException;import java.security.MessageDigest;import java.security. ...
- UIImagePickerController 相关
UIImagePickerController是系统封装好的一个导航视图控制器,使用其开发者可以十分方便的进行相机相册相关功能的调用.UIImagePickerController继承于UINavig ...
- Photos FrameWork 续
1. Model PHAsset .PHAssetCollection.PHCollectionList 是Photos框架中的模型类,PHAsset类模型是图片或者视频文件数据:PHAssetCol ...
- eclipse修改豆沙绿
长时间的使用eclipse开发会很累吧 设置一个保护眼睛的豆沙绿色 不刺眼 是不是会更好一些呢 那么如何设置呢现在就教大家 工具/原料 eclipse jdk 方法/步骤 1 首先打开eclip ...