結果

問題 No.185 和風
ユーザー maine_honzuki
提出日時 2020-11-18 22:03:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 297 bytes
コンパイル時間 2,765 ms
コンパイル使用メモリ 198,052 KB
最終ジャッジ日時 2025-01-16 01:36:29
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    set<int> S;
    cin >> N;
    while (N--) {
        int x, y;
        cin >> x >> y;
        S.insert(y - x);
    }
    int ans = *S.begin();
    if (ans <= 0 || S.size() != 1)
        ans = -1;
    cout << ans << endl;
}
0