Advertisement
Arch_of_Triumph

Untitled

Sep 25th, 2023
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n;
  6. int cnt[1010];
  7.  
  8. int main() {  
  9.     cin >> n;
  10.  
  11.     for (int i = 1; i <= n; i++) {
  12.         int l;
  13.         cin >> l;
  14.         cnt[l]++;
  15.     }
  16.  
  17.     int maxH = 0, towers = 0;
  18.     for (int i = 1; i <= 1000; i++) {
  19.         maxH = max(maxH, cnt[i]);
  20.         if (cnt[i] > 0)
  21.             towers++;
  22.     }
  23.  
  24.     cout << maxH << ' ' << towers;
  25. }
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement