Advertisement
amine99

Untitled

Mar 3rd, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define loop(i,b,e) for(ll i=b;i<=e;i++)
  5. #define reloop(i,e,b) for(ll i=e;i>=b;i--)
  6. #define ll long long
  7. #define pf printf
  8. #define sf scanf
  9.  
  10. const int N=1e5+1;
  11. int n,t[N],ans1,ans,v;
  12. map<int,int> m;
  13.  
  14. int main() {
  15. sf("%d",&n);
  16. loop(i,0,n-1) {
  17. sf("%d",&t[i]);
  18. m[t[i]]++;
  19. }
  20. sort(t,t+n);
  21. reloop(i,n-1,0) {
  22. v = m[t[i]];
  23. if(v >= 4) {
  24. ans = t[i];
  25. ans1=n-i-1+v-4;
  26. break;
  27. }
  28. }
  29. pf("%d %d",ans,ans1);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement