比赛 NOIP模拟赛1 评测结果 AAAAAATTTTTTTTTTTTTT
题目名称 天天爱射击 最终得分 30
用户昵称 Ceres 运行时间 14.026 s
代码语言 C++ 内存使用 2.32 MiB
提交时间 2018-02-08 21:36:56
显示代码纯文本
  1. #include <cstdio>
  2. using namespace std;
  3. int n=0,m=0,xx=0;
  4. struct node
  5. {
  6. int x,y,s;
  7. }a[200010];
  8. int ans=0;
  9. int main()
  10. {
  11. freopen("shooting.in","r",stdin);
  12. freopen("shooting.out","w",stdout);
  13. scanf("%d%d",&n,&m);
  14. for(int i=1;i<=n;i++)
  15. scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].s);
  16. for(int i=1;i<=m;i++)
  17. {
  18. ans=0;
  19. scanf("%d",&xx);
  20. for(int j=1;j<=n;j++)
  21. if(a[j].x<=xx && xx<=a[j].y)
  22. {
  23. a[j].s--;
  24. if(a[j].s==0)
  25. ans++;
  26. }
  27. printf("%d\n",ans);
  28. }
  29. return 0;
  30. }