比赛 NOIP模拟赛1 评测结果 WWWWWWTTTTTTTTTTTTTT
题目名称 天天爱射击 最终得分 0
用户昵称 sarail 运行时间 14.087 s
代码语言 C++ 内存使用 3.37 MiB
提交时间 2018-02-08 21:34:56
显示代码纯文本
  1. #include<iostream>
  2. #include<cstring>
  3. #include<cstdio>
  4. #include<algorithm>
  5. #include<vector>
  6. using namespace std;
  7. const int maxn=200000+100000;
  8.  
  9. vector<int> v[maxn];
  10.  
  11. int x1,x2,s,n,m,tmp,ans;
  12. int main(){
  13. freopen("shooting.in","r",stdin);
  14. freopen("shooting.out","w",stdout);
  15. cin>>n>>m;
  16. for(int i=0;i<n;i++){
  17. cin>>x1>>x2>>s;
  18. for(int j=x1;j<=x2;j++)
  19. v[j].push_back(s);
  20. }
  21. for(int i=0;i<m;i++){
  22. cin>>tmp;
  23. ans=0;
  24. for(int j=v[tmp].size()-1;j>=0;j--){
  25. v[tmp][j]--;
  26. if(v[tmp][j]==0)ans++;
  27. }
  28. cout<<ans;
  29. if(i!=m-1)cout<<endl;
  30. }
  31. return 0;
  32. }