結果

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

ソースコード

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 -1;
	}
	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