結果

問題 No.185 和風
ユーザー tntantntan
提出日時 2015-12-04 20:34:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 825 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 91,016 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-12 14:26:54
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cctype>
using namespace std;
typedef long long ll;

int main()
{
	int n, a, b;
	set<int>s;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;
		if (b - a <= 0)
		{
			cout << -1 << endl;
			return 0;
		}
		if (i == 0)s.insert(b - a);
		else
		{
			if (s.find(b - a) == s.end())
			{
				cout << -1 << endl;
				return 0;
			}
		}
	}
	set<int>::iterator ite;
	ite = s.begin();
	cout << *ite << endl;
	return 0;
}
0