結果

問題 No.3632 IQR
コンテスト
ユーザー Timosh
提出日時 2026-08-21 21:34:43
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.90.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 2,141 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,853 ms
コンパイル使用メモリ 368,316 KB
実行使用メモリ 10,216 KB
最終ジャッジ日時 2026-08-21 21:34:58
合計ジャッジ時間 6,683 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define vi vector<int>
#define vii vector<vi>
#define ld long double
#define pii pair<int, int>
mt19937 mt(time(0));

namespace io
{
    template <typename T, typename F>
    istream &operator>>(istream &cin, pair<T, F> &pr)
    {
        cin >> pr.first >> pr.second;
        return cin;
    }
    template <typename T, typename F>
    ostream &operator<<(ostream &cout, pair<T, F> &pr)
    {
        cout << pr.first << ' ' << pr.second;
        return cout;
    }
    template <typename T>
    istream &operator>>(istream &cin, vector<T> &vec)
    {
        for (T &i : vec)
            cin >> i;
        return cin;
    }
    template <typename T>
    ostream &operator<<(ostream &cout, vector<T> vec)
    {
        for (T i : vec)
            cout << i << ' ';
        return cout;
    }
}
using namespace io;

int M = 998244353;

int pw(int x, int y)
{
    x %= M;
    int res = 1;
    while (y)
    {
        if (y & 1)
            res = res * x % M;
        x = x * x % M, y /= 2;
    }
    return res;
}

int inv(int x) { return pw(x, M - 2); }

void solve()
{
    int n, u = 0;
    cin >> n;
    vector<long double> v(n);
    cin >> v;
    sort(all(v));
    cout << fixed << setprecision(10);
    long double q1 = v[(n - 1) / 4] + v[(n - 2) / 4];
    long double q2 = v[(n - 1) / 2] + v[(n) / 2];
    long double q3 = v[(3 * n) / 4] + v[(3 * n + 1) / 4];
    q1 /= 2, q2 /= 2, q3 /= 2;
    long double iqr = q3 - q1;
    iqr *= 1.5;
    for (auto &x : v)
        u += (x < q1 - iqr || x > q3 + iqr);
    cout << q1 << ' ' << q2 << ' ' << q3 << ' ' << u;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
        solve(), cout << '\n';
    return 0;
}
0