| 记录编号 |
360323 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
| 题目名称 |
2569.[東方] 博丽灵梦 梦想妙珠 |
最终得分 |
100 |
| 用户昵称 |
sxysxy |
是否通过 |
通过 |
| 代码语言 |
C++ |
运行时间 |
0.251 s |
| 提交时间 |
2016-12-29 11:13:25 |
内存使用 |
2.85 MiB |
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <list>
#include <queue>
#include <vector>
#include <algorithm>
#include <cctype>
using namespace std;
namespace IO
{
char buf[1<<18], *fs, *ft;
inline char readc()
{
return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<18,stdin),fs==ft))?0:*fs++;
}
inline int fast_read()
{
int r;
char c;
bool s = false;
while(c = readc())
{
if(c >= '0' && c <= '9')
{
r = c^0x30;
break;
}else if(c == '-')s = true;
}
while(isdigit(c = readc()))
r = (r<<3)+(r<<1)+(c^0x30);
return s?-r:r;
}
}using IO::fast_read;
#define MAXN 200001
vector<int> pos[MAXN];
int main()
{
// freopen("test_data.txt", "r", stdin);
freopen("mengxiangmiaozhu.in", "r", stdin);
freopen("mengxiangmiaozhu.out", "w", stdout);
int n = fast_read();
for(int i = 1; i <= n; i++)
pos[fast_read()].push_back(i);
int q = fast_read();
while(q--)
{
int l, r, v;
l = fast_read();
r = fast_read();
v = fast_read();
int p = upper_bound(pos[v].begin(), pos[v].end(), l-1)-pos[v].begin();
int q = lower_bound(pos[v].begin(), pos[v].end(), r+1)-pos[v].begin();
printf("%d\n", q-p);
}
return 0;
}