|
|
back to boardПочему WA7? #include <iostream> #include <algorithm> #include <math.h> #include <string.h> #include <stdio.h> using namespace std; unsigned int a[150002],k,kk,n,q,i; int main() { cin >> n; if(n > 150000){ k = n - 150000; n = 150000; } for(i = 1;i < n+1; i ++){ cin >> a[i]; } sort(a,a+n+1); for(i = 1; i <= k; i ++){ cin >> q; if(a[n] > q) a[i] = q; } if(k > 0) sort(a,a+n+1); if((n + k) % 2 == 1){ cout << a[ n / 2 + 1 - k]<< endl; }else { kk = a[n / 2 - k] % 2 + a[n / 2 + 1 - k] % 2; cout << (1ll * a[n / 2 - k] + a[n / 2 + 1 - k]) / 2; if(kk == 1)cout << ".5"; } } Re: Почему WA7? Sorry, was wrong. Edited by author 17.03.2016 14:29 |
|
|