結果

問題 No.185 和風
ユーザー testtest
提出日時 2020-09-06 13:39:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 200,284 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 13:52:49
合計ジャッジ時間 2,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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