結果

問題 No.3632 IQR
コンテスト
ユーザー abc864197532
提出日時 2026-08-21 21:27:23
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 48 ms / 2,000 ms
+ 838µs
コード長 1,575 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,186 ms
コンパイル使用メモリ 337,628 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-21 21:27:30
合計ジャッジ時間 5,838 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 63
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) ((int)a.size())
#ifdef Doludu
template <typename T>
ostream& operator << (ostream &o, vector <T> vec) {
    o << "{"; int f = 0;
    for (T i : vec) o << (f++ ? " " : "") << i;
    return o << "}";
}
void bug__(int c, auto ...a) {
    cerr << "\e[1;" << c << "m";
    (..., (cerr << a << " "));
    cerr << "\e[0m" << endl;
}
#define bug_(c, x...) bug__(c, __LINE__, "[" + string(#x) + "]", x)
#define bug(x...) bug_(32, x)
#define bugv(x...) bug_(36, vector(x))
#define safe bug_(33, "safe")
#else
#define bug(x...) void(0)
#define bugv(x...) void(0)
#define safe void(0)
#endif
const int mod = 998244353, N = 100005;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(all(a));
    auto solve = [&](int l, int r) {
        if ((r - l) & 1) {
            int m = l + r >> 1;
            return a[m] + a[m + 1];
        } else {
            return a[l + r >> 1] * 2;
        }
    };
    auto out = [&](int x) {
        cout << x / 2 << "." << (x % 2) * 5 << " ";
    };
    ll x = solve(0, n / 2 - 1), y = solve(0, n - 1), z = solve(n - n / 2, n - 1);
    out(x), out(y), out(z);
    ll gap = z - x;
    ll l = x * 2 - gap * 3, r = z * 2 + gap * 3;
    bug(l, r);
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (4ll * a[i] < l || 4ll * a[i] > r) cnt++;
    }
    cout << cnt << "\n";
}
0