結果

問題 No.185 和風
ユーザー kotatsugame
提出日時 2016-12-21 17:07:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 241 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 63,816 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 12:27:35
合計ジャッジ時間 992 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main() {
	int n;cin>>n;
	int a,b,c=-1;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		if(c==-1)c=b-a;
		else if(c!=b-a){cout<<-1<<endl;return 0;}
		if(c<=0){cout<<-1<<endl;return 0;}
	}
	cout<<c<<endl;
}
0