結果

問題 No.185 和風
ユーザー re1ns
提出日時 2015-11-06 17:25:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 396 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 59,684 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 13:04:32
合計ジャッジ時間 950 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<climits>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    int ans;
    cin >> n;
    int x,y;
    cin >> x >>y;
    ans = y-x;
    for(int i=0;i<n-1;i++){
        cin >> x >> y;
        if(y-x != ans){
            ans=-1;
            break;
        }
    }
    if(ans<-1||ans==0)ans=-1;
    cout << ans <<endl;
}

0