ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1306. Sequence Median

WA #5 wrong answer
Posted by Theodike 12 Feb 2019 21:41
My code is here:
--------------
#include <iostream>
using namespace std;

int compare(const void * x1, const void * x2) {
return (*(int*)x1 - *(int*)x2);
}

int main() {
long N;
cin >> N;
int *m = new int [N];

for (int i = 0; i < N; ++i) {
cin >> m[i];
}
qsort(m, N, sizeof(int), compare);

if (N % 2 == 0) {
cout << (((m[(N - 1)/ 2] + m[N / 2]) / 2.0)*10)/10;
}
else {
cout << m[N/2];
}

return 0;
}
--------------
Tell me please where I made a mistake
Re: WA #5 wrong answer
Posted by Alikhan Zimanov 18 Jan 2020 13:18
Try the following test:

4
2147483647
2147483647
2147483647
2147483647
Re: WA #5 wrong answer
Posted by Saik Maxim 14 Mar 2021 15:46
how to bypass this test?
Re: WA #5 wrong answer
Posted by Кирилл 10 May 2024 14:40
I tried to use if(arr[n / 2] == -1)cout << "2147483647";
but I still have WA on test 5