結果
問題 | No.1374 Absolute Game |
ユーザー |
![]() |
提出日時 | 2021-02-06 07:27:50 |
言語 | Crystal (1.14.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 364 bytes |
コンパイル時間 | 14,530 ms |
コンパイル使用メモリ | 295,916 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-07-02 15:25:36 |
合計ジャッジ時間 | 15,955 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end def solve(a) s = [0i64, 0i64] i = 0 until a.empty? s[i % 2] += a.pop i += 1 end s[0].abs - s[1].abs end n = read_line.to_i a = read_line.split.map(&.to_i64) a.map! { |i| -i } if a.sum < 0 a.sort! puts solve(a)