結果

問題 No.178 美しいWhitespace (1)
ユーザー diginatu
提出日時 2015-04-06 01:04:37
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 02:32:30
合計ジャッジ時間 1,367 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.conv, std.math, std.string, std.range, std.array,
       std.algorithm;

void main() {
  immutable N = readln().strip().to!int();

  int[] a;
  a.length = N;
  
  foreach(immutable int i; 0 .. N) {
    auto buf = readln().strip().split().map!(to!int)().array();
    a[i] = buf[0]/2 + buf[1]*2;
  }

  if(a.all!"a%2 == 1" || a.all!"a%2 == 0") {
    (a.reduce!max * N - a.reduce!"a+b").writeln();
  } else {
    writeln(-1);
  }

}
0