-
Notifications
You must be signed in to change notification settings - Fork 1
/
432A codeforces solution.cpp
71 lines (64 loc) · 1.43 KB
/
432A codeforces solution.cpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include<iostream>
#include<ctype.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<list>
#include<algorithm>
using namespace std;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ull unsigned long long
#define ll long long
#define pb push_back
#define for0(i,n) for (i=0; i<n; i++)
#define for1(i,n) for (i=1; i<=n; i++)
#define forab(i,a,b)for (i=a; i<=b; i++)
#define rof0(i,n) for (i=n-1; i>=0; i--)
#define rof1(i,n) for (i=n; i>=1; i--)
const int MOD = 1000000007;
const int MAX = 1000005;
int SetBit (int n, int x) { return n | (1 << x); }
int ClearBit (int n, int x) { return n & ~(1 << x); }
int ToggleBit (int n, int x) { return n ^ (1 << x); }
bool CheckBit (int n, int x) { return (bool)(n & (1 << x)); }
int main()
{
fast;
int n;
cin>>n;
int x;
vector<int>L;
for(int i=0;i<n;i++)
{
cin>>x;
L.pb(x);
}
sort(L.begin(),L.end());
vector<int>::iterator it;
it = L.begin();
/*for(it = L.begin();it!=L.end();it++)
{
cout<<*it<<" ";
}*/
int Size = L.size();
int val = Size/2;
if(Size%2==0 && val%2==0)
{
cout<<*(it+val-1)<<endl;
}
else if(Size%2!=0 && val%2==0)
{
cout<<*(it+val)<<endl;
}
else if(Size%2==0 && val%2!=0)
{
cout<<*(it+val-1)<<endl;
}
else
{
cout<<*(it+val)<<endl;
}
return 0;
}