結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2016-03-05 09:12:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 426 ms |
コンパイル使用メモリ | 58,756 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 14:14:53 |
合計ジャッジ時間 | 886 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include<iostream> #include<cmath> #include<string> using namespace std; int main(){ int N,X,Y; int ans=-1; int dame=1; cin>>N; for(int i=0;i<N;i++){ cin>>X>>Y; if(Y-X>0){ if(ans==-1) ans=Y-X; else if(ans!=Y-X) dame=-1; } else dame=-1; } if(dame==-1) cout<<"-1"<<endl; else cout<<ans<<endl; }