結果

問題 No.185 和風
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-03-05 09:12:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 321 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 58,640 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 19:51:10
合計ジャッジ時間 903 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0