結果
問題 | No.185 和風 |
ユーザー |
|
提出日時 | 2016-08-31 17:31:19 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 702 ms |
コンパイル使用メモリ | 120,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 04:02:35 |
合計ジャッジ時間 | 1,177 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random; import std.string, std.conv, std.stdio, std.typecons; void main() { auto n = readln.chomp.to!int; auto ai = iota(n) .map!(_ => readln.split.map!(to!int)) .map!(rd => rd[1] - rd[0]).array; if (ai.any!(a => a <= 0) || ai.length >= 2 && ai[1..$].any!(a => a != ai.front)) { writeln(-1); } else { writeln(ai.front); } }