結果

問題 No.185 和風
ユーザー test
提出日時 2020-09-06 13:39:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 193,292 KB
最終ジャッジ日時 2025-01-14 07:43:35
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

int solve() {
  int N, a, b, c;
  cin >> N;
  vector<int> v(N);
  rep(i, 0, N) {
    cin >> a >> b;
    v[i] = b - a;
    if (v[i] < 0) return -1;
  }
  if (N == 1) return v[0];
  rep(i, 0, N - 1) if (v[i] != v[i + 1]) return -1;
  return v[0];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << solve() << endl;
  getchar();
}
0