Submission #919692

#TimeUsernameProblemLanguageResultExecution timeMemory
919692vjudge1Inspections (NOI23_inspections)C++17
11 / 100
2060 ms21256 KiB
/****************************************************************************** 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...