# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293168 | Berted | Best Place (NOI17_bestplace) | C++14 | 196 ms | 4192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <algorithm>
#define pub push_back
#define ll long long
using namespace std;
const ll inft = 10000000000;
vector<ll> x,y;
ll as (ll n) {if (n<0) {return -n;} else {return n;}}
ll medianx()
{
if (x.size()%2) {return x[x.size()/2];}
else {return (x[x.size()/2-1] + x[x.size()/2])/2;}
}
ll mediany()
{
if (y.size()%2) {return y[y.size()/2];}
else {return (y[y.size()/2-1] + y[y.size()/2])/2;}
}
int main()
{
ll n,xt=0,yt=0,xmn=inft,ymn=inft,xmx=-1,ymx=-1,xrmin=inft,yrmin=inft,xrminr = inft,yrminr = inft;
cin>>n;
for (ll i=0;i<n;i++)
{
ll tx,ty;cin>>tx>>ty;
xt+=tx;yt+=ty;
xmx = max(xmx,tx);ymx = max(ymx,ty);
xmn = min(xmn,tx);ymn = min(ymn,ty);
x.pub(tx);y.pub(ty);
}
sort(x.begin(),x.end());sort(y.begin(),y.end());
cout<<medianx()<<" "<<mediany()<<"\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |