結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2015-11-02 13:40:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 464 bytes |
コンパイル時間 | 584 ms |
コンパイル使用メモリ | 59,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 07:01:43 |
合計ジャッジ時間 | 1,093 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include<iostream> #include<stdio.h> #include<vector> 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]; } int ans = y[0]-x[0]; bool flag = true; for(int i=1; i<n; i++){ if(ans != y[i]-x[i]){ flag = false; } } if(flag && ans>0){ cout<< ans<< endl; }else{ cout<< "-1"<< endl; } return 0; }