|
|
back to boardWA #5 wrong answer 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 Try the following test: 4 2147483647 2147483647 2147483647 2147483647 Re: WA #5 wrong answer 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 |
|
|