結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2015-04-06 01:09:30 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 891 ms |
コンパイル使用メモリ | 104,576 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 02:32:39 |
合計ジャッジ時間 | 1,709 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
import std.stdio, std.conv, std.math, std.string, std.range, std.array,std.algorithm;void main() {immutable N = readln().strip().to!int();long[] a;a.length = N;foreach(immutable int i; 0 .. N) {auto buf = readln().strip().split().map!(to!int)().array();a[i] = buf[0] + buf[1]*4;}if(a.all!"a%2 == 1" || a.all!"a%2 == 0") {((a.reduce!max * N - a.reduce!"a+b")/2).writeln();} else {writeln(-1);}}