/***
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
vector<int> data ;
int main()
{
int n,m;
while(cin>>n )
{
for(int i=0 ; i<n ; i++)
{
cin>>m ;
data.push_back(m) ;
}
sort(data.begin() ,data.end()) ;
int l = (n-1)/2 , r;
if(n%2)
r = l ;
else
r= l+1 ;
int cnt =0 ;
for(int i=0 ; i<n ; i++)
{
if(data[l] <= data[i] && data[i] <= data[r])
cnt++ ;
if(data[r] < data[i])
break ;
}
pf("%d %d %d\n",data[l],cnt,data[r]-data[l]+1) ;
data.clear() ;
}
return 0;
}
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
vector<int> data ;
int main()
{
int n,m;
while(cin>>n )
{
for(int i=0 ; i<n ; i++)
{
cin>>m ;
data.push_back(m) ;
}
sort(data.begin() ,data.end()) ;
int l = (n-1)/2 , r;
if(n%2)
r = l ;
else
r= l+1 ;
int cnt =0 ;
for(int i=0 ; i<n ; i++)
{
if(data[l] <= data[i] && data[i] <= data[r])
cnt++ ;
if(data[r] < data[i])
break ;
}
pf("%d %d %d\n",data[l],cnt,data[r]-data[l]+1) ;
data.clear() ;
}
return 0;
}
No comments:
Post a Comment