結果

問題 No.2821 A[i] ← 2A[j] - A[i]
ユーザー hiromi_ayasehiromi_ayase
提出日時 2024-07-26 23:20:27
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 429 ms / 1,500 ms
コード長 703 bytes
コンパイル時間 5,885 ms
コンパイル使用メモリ 309,184 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-07-26 23:20:39
合計ジャッジ時間 11,062 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 416 ms
7,936 KB
testcase_02 AC 416 ms
7,936 KB
testcase_03 AC 429 ms
7,864 KB
testcase_04 AC 253 ms
6,940 KB
testcase_05 AC 266 ms
6,944 KB
testcase_06 AC 152 ms
6,940 KB
testcase_07 AC 148 ms
6,940 KB
testcase_08 AC 223 ms
6,944 KB
testcase_09 AC 71 ms
6,944 KB
testcase_10 AC 74 ms
6,944 KB
testcase_11 AC 73 ms
6,944 KB
testcase_12 AC 72 ms
6,944 KB
testcase_13 AC 73 ms
6,944 KB
testcase_14 AC 100 ms
6,940 KB
testcase_15 AC 109 ms
6,944 KB
testcase_16 AC 58 ms
6,944 KB
testcase_17 AC 93 ms
6,940 KB
testcase_18 AC 100 ms
6,944 KB
testcase_19 AC 13 ms
6,940 KB
testcase_20 AC 14 ms
6,940 KB
testcase_21 AC 6 ms
6,944 KB
testcase_22 AC 8 ms
6,940 KB
testcase_23 AC 9 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 3 ms
6,940 KB
testcase_26 AC 3 ms
6,940 KB
testcase_27 AC 4 ms
6,940 KB
testcase_28 AC 3 ms
6,940 KB
testcase_29 AC 3 ms
6,944 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 3 ms
6,940 KB
testcase_33 AC 4 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO                \
  ios::sync_with_stdio(false); \
  cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;

int main() {
  FAST_IO
  auto ans = 0LL;

  int N;
  cin >> N;
  vector<i64> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  vector<i64> B(N - 1);
  for (int i = 0; i < N - 1; i++) {
    B[i] = abs(A[i + 1] - A[i]);
  }

  cout << 0 << endl;
  i64 cur = B[0];
  for (int i = 0; i < N - 1; i++) {
    cur = gcd(cur, B[i]);
    cout << cur << endl;
  }
}
0