結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
|
提出日時 | 2017-01-27 12:26:34 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 894 ms |
コンパイル使用メモリ | 104,576 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 06:38:15 |
合計ジャッジ時間 | 1,973 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto rgb = readln.split.to!(int[]); auto canMake(int a, int _) { auto l = rgb.filter!(b => b < a).map!(b => a - b).sum; auto e = rgb.filter!(b => b > a).map!(b => (b - a) / 2).sum; return l <= e; } if (rgb.sum == 0) writeln(0); else writeln(rgb.sum.iota.assumeSorted!canMake.lowerBound(0).back); }