結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
tntan
|
| 提出日時 | 2015-12-04 20:34:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 825 bytes |
| コンパイル時間 | 1,008 ms |
| コンパイル使用メモリ | 93,680 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 13:20:17 |
| 合計ジャッジ時間 | 1,816 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#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;
}
tntan