Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- #include<iostream>
- #include<iomanip>
- #include<set>
- using namespace std;
- //ifstream f("1306.in");
- struct cmp
- { bool operator()(unsigned int a, unsigned int b)
- { return a > b;
- }
- };
- int N;
- multiset<unsigned int, cmp> h;
- int main()
- { int i, j;
- double rez;
- cin>>N;
- for(i = 1; i <= N; i++)
- { cin>>j;
- if(i > N / 2 + 1)
- { if(j < *h.begin())
- h.erase(h.begin()), h.insert(j);
- }else h.insert(j);
- }
- if(N % 2) rez = *h.begin();
- else
- { rez = *h.begin();
- h.erase(h.begin());
- rez += *h.begin();
- rez /= 2;
- }
- cout.precision(1);
- cout<<fixed<<rez<<'\n';
- //f.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment