比赛 NOIP模拟赛1 评测结果 AAAAAATTTTTTTTTTTTTT
题目名称 天天爱射击 最终得分 30
用户昵称 FYJ 运行时间 14.027 s
代码语言 C++ 内存使用 0.28 MiB
提交时间 2018-02-08 21:34:13
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n,m,used[1005];
  4. struct node{
  5. int x1,x2,s;
  6. }t[1005];
  7. inline void init(){
  8. freopen("shooting.in","r",stdin);
  9. freopen("shooting.out","w",stdout);
  10. }
  11. inline void end(){
  12. fclose(stdin);
  13. fclose(stdout);
  14. }
  15. int main(){
  16. init();
  17. scanf("%d%d",&n,&m);
  18. for(int i=1;i<=n;++i){
  19. scanf("%d%d%d",&t[i].x1,&t[i].x2,&t[i].s);
  20. }
  21. for(int i=1;i<=m;++i){
  22. int x,sum=0;
  23. scanf("%d",&x);
  24. for(int j=1;j<=n;++j){
  25. if(t[j].s>0){
  26. if(x>=t[j].x1&&x<=t[j].x2){
  27. t[j].s--;
  28. if(t[j].s==0)sum++;
  29. }
  30. }
  31. }
  32. printf("%d\n",sum);
  33. }
  34. end();
  35. return 0;
  36. }