This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,q;
cin>>n>>m>>q;
long long int last[n+1];
for(int i = 1;i<=n;i++)last[i]=-1;
vector<long long int> dist[n+1];
long long int d = 0;
for(int i =0;i<m;i++){
int l,r;
cin>>l>>r;
for(int i =l;i<=r;i++){
if(last[i]!=-1)dist[i].push_back(d-last[i]-1);
last[i]=d;
d++;
}
}
for(int i =1;i<=n;i++)sort(dist[i].begin(),dist[i].end());
while(q--){
int cnt = 0;
long long int s;
cin>>s;
for(int i = 1;i<=n;i++){
cnt+=(dist[i].end()-lower_bound(dist[i].begin(),dist[i].end(),s));
}
cout<<cnt<<" ";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |