当前位置:网站首页>Ccf-csp 202203-2 travel plan 100 points difference

Ccf-csp 202203-2 travel plan 100 points difference

2022-06-09 02:43:00 Confident little screw

Original link :CCF-CSP 202203-2 Travel plan
 Insert picture description here

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+10;

int a[N];

int main()
{
    
    std::ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n,m,k;
    cin>>n>>m>>k;
    int ti,c,q;
    int num=0;
    for(int i=0;i<n;i++)
    {
    
        cin>>ti>>c;
        int t1=ti+1-k-c>0 ? ti+1-k-c: 0;    // First to make nucleic acid 
        int t2=ti-k>0 ? ti-k:0;// Make nucleic acid at the latest 
        num=max(num,ti);
        if(t1==0 && t2==0) continue;
        a[t1]+=1;
        a[t2+1]-=1;
    }
    for(int i=1;i<=num;i++) a[i]+=a[i-1];
    while(m--)
    {
    
        cin>>q;
        cout<<a[q]<<endl;
    }
    return 0;
}

原网站

版权声明
本文为[Confident little screw]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/159/202206081210203539.html