Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: kavin8888
Problemset: Find Score
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-23 11:20:19
#include<bits/stdc++.h>
using namespace std;
#define spps1 ios::sync_with_stdio(false)
#define spps2 cin.tie(nullptr)
int partition(vector<int> &a,int low,int high)
{
int pivot=a[low];
int i=low-1,j=high+1;
while(true)
{
do
{
i++;
}while(a[i]<pivot);
do
{
j--;
}while(a[j]>pivot);
if(i>=j) return j;
swap(a[i],a[j]);
}
}
void Qsort(vector<int> &a,int low,int high)
{
if(low<high)
{
int pivot=partition(a,low,high);
Qsort(a,low,pivot);
Qsort(a,pivot+1,high);
}
return;
}
int main()
{
int n; cin>>n;
long double ans=0;
vector<int> a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
ans=ans+a[i];
}
Qsort(a,0,n-1);
cout<<a[n-1]<<'\n'<<a[0]<<'\n';
cout<<fixed<<setprecision(2)<<ans/n<<'\n';
return 0;
}