Advertisement
Josif_tepe

Untitled

Jun 10th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     map<int, int> mapa;
  10.     for(int i = 0; i < n; i++) {
  11.         int S, E;
  12.         cin >> S >> E;
  13.         mapa[S] += 1;
  14.         mapa[E + 1] -= 1;
  15.     }
  16.     int zbir = 0;
  17.     int customers = 0;
  18.     for(auto x : mapa) {
  19.         zbir += x.second;
  20.         if(zbir > customers) {
  21.             customers = zbir;
  22.         }
  23.     }
  24.     cout << customers << endl;
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement