# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112951 | Aviansh | Inspections (NOI23_inspections) | C++17 | 1777 ms | 1048576 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m,q;
cin >> n >> m >> q;
vector<int>arr;
for(int i = 0;i<m;i++){
int a,b;
cin >> a >> b;
for(int j = a;j<=b;j++){
arr.push_back(j);
}
}
vector<int>pos[n];
for(int i = 0;i<arr.size();i++){
pos[arr[i]-1].push_back(i);
}
vector<int>diff;
for(int i = 0;i<n;i++){
for(int j = 1;j<pos[i].size();j++){
diff.push_back(pos[i][j]-pos[i][j-1]);
}
}
sort(diff.begin(),diff.end());
while(q--){
int p;
cin >> p;
cout << (diff.size() - (upper_bound(diff.begin(),diff.end(),p)-diff.begin())) << " ";
}
return 0;
}
Compilation message (stderr)
# | 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... |