結果

問題 No.185 和風
ユーザー mkawa2
提出日時 2020-01-16 01:17:37
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
+ 9µs
コード長 534 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,060 ms
コンパイル使用メモリ 183,172 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2026-11-12 13:42:16
合計ジャッジ時間 2,242 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const ll inf = 1e16;
const ll md = 1000000007;

int main() {
  int n,x,y;
  cin>>n>>x>>y;
  int ans=y-x;
  if(ans<=0){
    puts("-1");
    return 0;
  }
  rep(i,n-1){
    cin>>x>>y;
    if(y-x!=ans){
      puts("-1");
      return 0;
    }
  }
  cout<<ans<<endl;
  return 0;
}
0