結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2015-04-19 23:25:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 660 ms |
コンパイル使用メモリ | 80,124 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 18:19:56 |
合計ジャッジ時間 | 1,127 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; int main(){ int N; cin >> N; vector<int> x(N), y(N); for(int i=0; i<N; i++){ cin >> x[i] >> y[i]; } set<int> ans; for(int i=0; i<N; i++){ ans.insert(y[i] - x[i]); } if(ans.size() == 1 && *ans.begin() > 0) cout << *ans.begin() << endl; else cout << -1 << endl; return 0; }