結果

問題 No.185 和風
ユーザー Manuel1024
提出日時 2021-03-05 02:49:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 368 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 70,460 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 18:12:35
合計ジャッジ時間 1,123 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
    int ans = y[0]-x[0];
    for(int i = 0; i < n; i++){
        if(ans == -1) continue;
        else if(ans <= 0 || ans != y[i]-x[i]) ans = -1;
    }
    cout << ans << endl;
    return 0;
}
0