結果

問題 No.185 和風
ユーザー mannshi222
提出日時 2022-04-27 21:58:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 328 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 65,472 KB
最終ジャッジ日時 2025-01-28 22:04:43
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main()
{

	int N, X, Y;
	cin >> N;

	int ans;
	cin >> X >> Y;
	ans = Y - X;
	if( ans <= 0 ) {
		cout << -1 << endl;
		return 0;
	}
	for( int i = 1; i < N; i++ ) {
		cin >> X >> Y;
		if( Y - X != ans ) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << ans << endl;

	return 0;
}
0