結果
| 問題 | No.275 中央値を求めよ |
| コンテスト | |
| ユーザー |
C
|
| 提出日時 | 2026-09-16 03:24:00 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 438µs | |
| コード長 | 386 bytes |
| 記録 | |
| コンパイル時間 | 4,436 ms |
| コンパイル使用メモリ | 389,124 KB |
| 実行使用メモリ | 10,040 KB |
| 最終ジャッジ日時 | 2026-09-16 03:24:07 |
| 合計ジャッジ時間 | 6,555 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll=long long;
using vll=vector<ll>;
using pll=pair<ll,ll>;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N;
cin>>N;
vll a(N+1);
for(int i=1;i<=N;++i)cin>>a[i];
sort(a.begin()+1,a.end());
if(N%2==1)cout<<a[(N+1)/2]<<endl;
else cout<<(a[N/2]+a[N/2+1])/2.0<<endl;
}
C