結果
問題 |
No.185 和風
|
ユーザー |
|
提出日時 | 2016-04-08 11:36:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 460 ms |
コンパイル使用メモリ | 60,024 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 04:49:00 |
合計ジャッジ時間 | 900 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int n; cin >> n; int x = 0; int y = 0; vector<int> vec; int ans = -1; for (int i = 0; i < n; ++i) { cin >> x >> y; if (x >= y) { break; } else { vec.push_back(y - x); } } if (!vec.empty()) { ans = vec.at(0); for (size_t j = 0; j < vec.size(); ++j) { if (ans != vec.at(j)) { ans = -1; break; } } } cout << ans << endl; return 0; }