比赛 |
2024暑假C班集训B |
评测结果 |
AWWAAAAAAAAAAAAAAAAA |
题目名称 |
天天爱射击 |
最终得分 |
90 |
用户昵称 |
┭┮﹏┭┮ |
运行时间 |
15.141 s |
代码语言 |
C++ |
内存使用 |
53.74 MiB |
提交时间 |
2024-07-11 11:02:55 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define in inline
#define re register
const int N = 2e5+10,M = N<<5;
const ll mod = 1e9+7;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,m;
struct query{int l,r,s;}a[N];
int root[N],cnt = 0;
struct segment{
int ls[M],rs[M],sum[M] = {0};
in void build(int &p,int l,int r){
if(!p)p = ++cnt;
sum[p] = 0;
if(l == r)return;
int mid = l + r >> 1;
build(ls[p],l,mid),build(rs[p],mid+1,r);
}
in void add(int la,int &now,int l,int r,int x){
now = ++cnt;
ls[now] = ls[la],rs[now] = rs[la];
sum[now] = sum[la] + 1;
if(l == r)return;
int mid = l + r >> 1;
if(x <= mid)add(ls[la],ls[now],l,mid,x);
else add(rs[la],rs[now],mid+1,r,x);
}
in int ask(int p,int l,int r,int x){
if(l == r)return sum[p];
int mid = l + r >> 1;
if(x <= mid)return ask(ls[p],l,mid,x);
else return sum[ls[p]] + ask(rs[p],mid+1,r,x);
}
}t;
int ans[N];
int main(){
freopen("shooting.in","r",stdin);
freopen("shooting.out","w",stdout);
n = read(),m = read();
for(re int i = 1;i <= n;i++)a[i].l = read(),a[i].r = read(),a[i].s = read();
t.build(root[0],1,2e5);
for(re int i = 1;i <= m;i++)t.add(root[i-1],root[i],1,2e5,read());
for(re int i = 1;i <= n;i++){
int l = 1,r = m+1;
while(l < r){
int mid = l + r >> 1;
if(t.ask(root[mid],1,2e5,a[i].r) - t.ask(root[mid],1,2e5,a[i].l-1) >= a[i].s)r = mid;
else l = mid + 1;
}
ans[l]++;
}
ll s = 0;
for(int i = 1;i <= m;i++)printf("%d\n",ans[i]);
return cerr<<clock()<<"ms"<<endl,0;
}