結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
nak2yoshi
|
| 提出日時 | 2016-02-23 02:47:01 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 422 bytes |
| コンパイル時間 | 1,465 ms |
| コンパイル使用メモリ | 148,096 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 03:01:30 |
| 合計ジャッジ時間 | 1,862 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
import std.stdio,
std.conv,
std.string,
std.range,
std.math,
std.algorithm;
void main()
{
auto N = readln.strip.to!int;
int[] X, Y;
foreach (_; 0 .. N)
{
auto input = readln.split.to!(int[]);
X ~= input[0];
Y ~= input[1];
}
auto ans = zip(X, Y).map!(a => a[1]-a[0]).uniq;
(ans.count > 1 || ans.front < 1 ? -1 : ans.front).writeln;
}
nak2yoshi