結果
問題 | No.609 Noelちゃんと星々 |
ユーザー |
![]() |
提出日時 | 2017-12-09 00:06:10 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 496 bytes |
コンパイル時間 | 803 ms |
コンパイル使用メモリ | 108,760 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 22:55:08 |
合計ジャッジ時間 | 2,808 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
void main(){import std.stdio, std.string, std.conv, std.algorithm;import std.math;int n; rd(n);auto a=readln.split.to!(long[]);sort(a);auto md=a[n/2];writeln(reduce!((r, e)=>r+(e-md).abs)(0L, a));}void rd(T...)(ref T x){import std.stdio, std.string, std.conv;auto l=readln.split;assert(l.length==x.length);foreach(i, ref e; x){e=l[i].to!(typeof(e));}}void wr(T...)(T x){import std.stdio;foreach(e; x) stderr.write(e, " ");stderr.writeln;}