結果
| 問題 | 
                            No.91 赤、緑、青の石
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-08-30 13:25:57 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 531 bytes | 
| コンパイル時間 | 731 ms | 
| コンパイル使用メモリ | 118,412 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 03:51:11 | 
| 合計ジャッジ時間 | 1,701 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 28 | 
ソースコード
import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv, std.bigint, std.math, std.random;
import std.stdio, std.typecons;
const auto max = 10 ^^ 7;
void main()
{
  auto rgb = readln.split.map!(to!int);
  bool calc(int i, int _)
  {
    auto a = rgb.map!(x => x - i);
    auto b = a.filter!(x => x > 0).map!(x => x / 2).sum;
    auto c = a.filter!(x => x < 0).map!(x => -x).sum;
    return b >= c;
  }
  auto r = iota(max + 1).map!(to!int).assumeSorted!(calc).lowerBound(0);
  writeln(r.back);
}