ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1306. Sequence Median

getting constant Memory Limit Exceeded
Posted by chang 28 Dec 2013 23:20
Re: getting constant Memory Limit Exceeded
Posted by chang 28 Dec 2013 23:21
#include <bits/stdc++.h>
using namespace std;

typedef long long ill;
ill arr[250000];
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> arr[i];

    nth_element(arr,arr+n/2,arr+n);
    double ans = (double)arr[(n/2)];

    if (n & 1){
        printf("%0.1lf\n",ans);
    }
    else {
        nth_element(arr,arr+(n/2)-1,arr+n);
        ans += (double)arr[(n/2)-1];
        printf("%0.1lf\n",ans/2.0);
    }
    return 0;
}

Can somebody tell me the problem ....