Advertisement
Josif_tepe

Untitled

Jul 26th, 2024
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.    int n;
  8.    cin >> n;
  9.  
  10.     vector<int> v(100000, 0);
  11.    for(int i = 0; i < n; i++) {
  12.     string S, E;
  13.     cin >> S >> E;
  14.  
  15.     int h = (S[0] - '0') * 10 + (S[1] - '0');
  16.     int m = (S[3] - '0') * 10 + (S[4] - '0');
  17.     int s = (S[6] - '0') * 10 + (S[7] - '0');
  18.  
  19.     int t = h * 3600 + m * 60 + s;
  20.  
  21.     v[t]++;
  22.  
  23.     h = (E[0] - '0') * 10 + (E[1] - '0');
  24.     m = (E[3] - '0') * 10 + (E[4] - '0');
  25.     s = (E[6] - '0') * 10 + (E[7] - '0');
  26.  
  27.     t = h * 3600 + m * 60 + s;
  28.     v[t + 1]--;
  29.    }
  30.  
  31.    int sum = 0;
  32.    int res = 0;
  33.    for(int i = 0; i < 100000; i++) {
  34.       sum += v[i];
  35.       res = max(res, sum);
  36.    }
  37.   cout << res << endl;
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement