結果

問題 No.185 和風
ユーザー drken1215
提出日時 2015-04-19 23:29:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 372 bytes
コンパイル時間 445 ms
コンパイル使用メモリ 63,532 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 18:24:01
合計ジャッジ時間 899 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;

int N;

int solve() {
    cin >> N;
    set<int> se;
    for (int i = 0; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        se.insert(y-x);
    }
    if (se.size() > 1) return -1;
    int res = *se.begin();
    if (res > 0) return res;
    else return -1;
}


int main() {
    cout << solve() << endl;
}
0