結果

問題 No.275 中央値を求めよ
ユーザー Mister
提出日時 2020-03-31 21:06:43
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 130,108 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 17:15:56
合計ジャッジ時間 1,913 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> xs(n * 2);
    for (int i = 0; i < n; ++i) {
        std::cin >> xs[i * 2];
        xs[i * 2 + 1] = xs[i * 2];
    }

    std::sort(xs.begin(), xs.end());
    int s = xs[n - 1] + xs[n];

    std::cout << s / 2 << (s % 2 == 0 ? "" : ".5") << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0