Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define loop(i,b,e) for(ll i=b;i<=e;i++)
- #define reloop(i,e,b) for(ll i=e;i>=b;i--)
- #define ll long long
- #define pf printf
- #define sf scanf
- const int N=1e5+1;
- int n,t[N],ans1,ans,v;
- map<int,int> m;
- int main() {
- sf("%d",&n);
- loop(i,0,n-1) {
- sf("%d",&t[i]);
- m[t[i]]++;
- }
- sort(t,t+n);
- reloop(i,n-1,0) {
- v = m[t[i]];
- if(v >= 4) {
- ans = t[i];
- ans1=n-i-1+v-4;
- break;
- }
- }
- pf("%d %d",ans,ans1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement