結果
問題 |
No.185 和風
|
ユーザー |
|
提出日時 | 2015-11-13 18:51:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 384 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 54,332 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 14:35:01 |
合計ジャッジ時間 | 958 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include <iostream> int main() { int n; std::cin >> n; int temp; {int x, y; std::cin >> x >> y; temp = y - x; } for (auto i = 1; i < n; ++i) { int x, y; std::cin >> x >> y; if (temp != (y - x) || temp < 1) { std::cout << -1 << std::endl; return 0; } } if (temp > 0) { std::cout << temp << std::endl; } else { std::cout << -1 << std::endl; } return 0; }