結果
| 問題 | 
                            No.185 和風
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kongarishisyamo
                         | 
                    
| 提出日時 | 2016-03-05 09:09:14 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 306 bytes | 
| コンパイル時間 | 465 ms | 
| コンパイル使用メモリ | 59,076 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 14:14:48 | 
| 合計ジャッジ時間 | 907 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 WA * 2 | 
ソースコード
#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;
		}
	}
	if(dame==-1) cout<<"-1"<<endl;
	else cout<<ans<<endl;
}
            
            
            
        
            
kongarishisyamo