結果

問題 No.2860 Heal Slimes
ユーザー t98slidert98slider
提出日時 2024-08-27 01:56:55
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 2,161 ms
コンパイル使用メモリ 204,728 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-08-27 01:57:02
合計ジャッジ時間 6,366 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50 WA * 10
権限があれば一括ダウンロードができます

ソースコード

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);
	vector<ll> sv(k);
	cin >> h;
	for(int i = 0; i + 1 < n; i++){
		int d = h[i + 1] - h[i];
		if(d % x != 0) return false;
		sv[(i + 1) % k] += d;
	}
	sv[0] = 0, sv[n % k] = 0;
	return count(sv.begin(), sv.end(), 0) == k;
}

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