Submission #1112951

#TimeUsernameProblemLanguageResultExecution timeMemory
1112951AvianshInspections (NOI23_inspections)C++17
29 / 100
1777 ms1048576 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int i = 0;i<arr.size();i++){
      |                   ~^~~~~~~~~~~
Main.cpp:24:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j = 1;j<pos[i].size();j++){
      |                       ~^~~~~~~~~~~~~~
#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...