結果
| 問題 |
No.2860 Heal Slimes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-27 01:59:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 673 bytes |
| コンパイル時間 | 1,957 ms |
| コンパイル使用メモリ | 195,988 KB |
| 最終ジャッジ日時 | 2025-02-24 02:22:28 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 WA * 10 |
ソースコード
// 分からないので解説を見た
#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] = min(0ll, sv[0]), sv[n % k] = max(0ll, sv[n % k]);
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';
}