首页 > 其他 > 详细

ural 1613 For Fans of Statistics

时间:2014-03-17 02:45:02      阅读:515      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
bubuko.com,布布扣
 1 #include <cstdio>
 2 #include <cstring>
 3 #include <map>
 4 #include <vector>
 5 #include <algorithm>
 6 using namespace std;
 7 map<int,vector<int> >t;
 8 vector<int>::iterator it;
 9 int main()
10 {
11     int n,x;
12     scanf("%d",&n);
13     for(int i=1; i<=n; i++)
14     {
15         scanf("%d",&x);
16         t[x].push_back(i);
17     }
18     int m,r,l;
19     scanf("%d",&m);
20     for(int i=1; i<=m; i++)
21     {
22         scanf("%d%d%d",&l,&r,&x);
23         it=lower_bound(t[x].begin(),t[x].end(),l);
24         if(it==t[x].end()) printf("0");
25         else if((*it)<=r) printf("1");
26         else printf("0");
27     }
28     printf("\n");   
29     return 0;
30 }
View Code
bubuko.com,布布扣

ural 1613 For Fans of Statistics,布布扣,bubuko.com

ural 1613 For Fans of Statistics

原文:http://www.cnblogs.com/fanminghui/p/3604107.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!