-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path673-Parentheses Balance.cpp
More file actions
57 lines (42 loc) · 1.04 KB
/
673-Parentheses Balance.cpp
File metadata and controls
57 lines (42 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*----------------------|
/ Author : Ashraf Tasin |
/ Date : 05.01.19 |
/----------------------*/
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define all v.begin(),v.end()
#define M it=m.begin(),it!=m.end(),it++
#define flash ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define db double
#define endl "\n"
#define mnm pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>
#define show for(int i=0;i<v.size();i++) cout << v[i] << " ";
using namespace std;
/*King Moves
int dx[]={-1,1,-1,0,1,-1,0,1};
int dy[]={0,0,-1,-1,-1,1,1,1}; */
/*Knight Moves
int dx[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int dy[] = { 1, 2, 2, 1, -1, -2, -2, -1 }; */
/*Normal Moves
int x[] = {0, 1, 0, -1};
int y[] = {-1, 0, 1, 0}; */
int main()
{
ll n;
cin >> n;
vector<db> v;
for(int i=0;i<n;i++)
{
db x;
cin >> x;
v.pb(x);
}
sort(all);
n--;
if(n%2!=0) cout << (v[n/2]+v[(n/2)+1])/2 << endl;
else cout << v[(n/2)+1] << endl;
return 0;
}