結果
| 問題 | 
                            No.178 美しいWhitespace (1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nak2yoshi
                         | 
                    
| 提出日時 | 2016-03-01 16:09:41 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 9 ms / 2,000 ms | 
| コード長 | 521 bytes | 
| コンパイル時間 | 1,684 ms | 
| コンパイル使用メモリ | 134,232 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-12 03:12:05 | 
| 合計ジャッジ時間 | 2,121 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 21 | 
ソースコード
import std.stdio,
       std.conv,
       std.string,
       std.range,
       std.math,
       std.bigint,
       std.algorithm,
       core.bitop;
void main()
{
    auto N = readln.strip.to!int;
    long[] a, b;
    foreach (_; 0 .. N)
    {
        auto input = readln.split.to!(long[]);
        a ~= input[0];
        b ~= input[1];
    }
    auto widths = zip(a, b).map!"a[0]+4*a[1]";
    auto diffs  = widths.map!(diff => widths.reduce!max-diff);
    (diffs.filter!"a%2==1".empty ? diffs.sum / 2 : -1).writeln;
}
            
            
            
        
            
nak2yoshi