結果
問題 |
No.2821 A[i] ← 2A[j] - A[i]
|
ユーザー |
|
提出日時 | 2024-07-26 23:03:21 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 498 bytes |
コンパイル時間 | 1,164 ms |
コンパイル使用メモリ | 84,000 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-26 23:03:29 |
合計ジャッジ時間 | 4,903 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 33 |
ソースコード
#include <iostream> #include <numeric> using namespace std; typedef long long ll; const int MAX_N = 300000; int N; ll A[MAX_N], res; int main() { cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; if (N == 1) cout << 0 << endl; else { cout << 0 << " "; res = abs(A[1] - A[0]); for (int i = 1; i < N; i++) { res = gcd(res, abs(A[i] - A[0])); cout << res << ((i == N - 1) ? "\n" : " "); } } return 0; }