比赛 2024暑假C班集训B 评测结果 AAAAAATTTTTTTTTTTTTT
题目名称 天天爱射击 最终得分 30
用户昵称 ht骨架 运行时间 56.101 s
代码语言 C++ 内存使用 4.94 MiB
提交时间 2024-07-11 09:53:36
显示代码纯文本
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, m, x1[200005], x2[200005], a[200005], x;
  4. bool o[200005] = {false};
  5. int main () {
  6. freopen ("shooting.in", "r", stdin);
  7. freopen ("shooting.out", "w", stdout);
  8. cin >> n >> m;
  9. for (int i = 1; i <= n; i++) {
  10. cin >> x1[i] >> x2[i] >> a[i];
  11. }
  12. for (int i = 1; i <= m; i++) {
  13. cin >> x;
  14. int ans = 0;
  15. for (int j = 1; j <= n; j++) {
  16. if (x >= x1[j] && x <= x2[j]) {
  17. a[j] --;
  18. if (a[j] <= 0 && o[j] == false) ans ++, o[j] = true;
  19. }
  20. }
  21. cout << ans << endl;
  22. }
  23. return 0;
  24. }