結果

問題 No.2860 Heal Slimes
ユーザー t98slider
提出日時 2024-08-27 01:47:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 194,424 KB
最終ジャッジ日時 2025-02-24 02:22:07
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
	for(T& x : vec) is >> x;
	return is;
}

bool solve(){
	int n, k, x;
	cin >> n >> k >> x;
	vector<int> h(n);
	cin >> h;
	int g = 0;
	for(int i = 0; i + 1 < n; i++){
		g = gcd(g, abs(h[i + 1] - h[i]));
	}
	return g % x == 0;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T;
	cin >> T;
	while(T--) cout << (solve() ? "Yes" : "No") << '\n';
}
0