比赛 |
NOIP模拟赛1 |
评测结果 |
AAAAAATTTTTTTTTTTTTT |
题目名称 |
天天爱射击 |
最终得分 |
30 |
用户昵称 |
Tony |
运行时间 |
14.042 s |
代码语言 |
C++ |
内存使用 |
2.02 MiB |
提交时间 |
2018-02-08 21:05:56 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int RD(){
int flag = 1,out = 0;char c = getchar();
while(c < '0' || c > '9'){if(c == '-')flag = -1;c = getchar();}
while(c >= '0' && c <= '9'){out = out * 10 + c - '0';c = getchar();}
return flag * out;
}
#define lowbit(i) ((i)&(-i))
const int maxn = 200100;
int num,nask;
struct W{
int l,r;
int hp;
}w[maxn];
bool cmp(W a,W b){
if(a.l != b.l)return a.l < b.l;
return a.r > b.r;
}
int s[maxn];
int main(){
freopen("shooting.in","r",stdin);
freopen("shooting.out","w",stdout);
num = RD();nask = RD();
int x,y,v;
for(int i = 1;i <= num;i++){
w[i].l = RD();
w[i].r = RD();
w[i].hp = RD();
}
sort(w + 1,w + 1 + num,cmp);
for(int i = 1;i <= nask;i++){
int cnt = 0;
s[i] = RD();
for(int j = 1;j <= num;j++){
if(w[j].l <= s[i] && w[j].r >= s[i]){
w[j].hp--;
if(w[j].hp == 0)cnt++;
}
if(w[j].l > s[i])break;
}
cout<<cnt<<endl;
}
fclose(stdin);
fclose(stdout);
return 0;
}