結果

問題 No.2860 Heal Slimes
ユーザー 沙耶花沙耶花
提出日時 2024-08-25 14:58:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,097 bytes
コンパイル時間 4,465 ms
コンパイル使用メモリ 269,172 KB
実行使用メモリ 7,148 KB
最終ジャッジ日時 2024-08-25 14:59:08
合計ジャッジ時間 11,718 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 74 ms
6,944 KB
testcase_11 AC 73 ms
6,940 KB
testcase_12 AC 75 ms
6,940 KB
testcase_13 AC 74 ms
6,944 KB
testcase_14 AC 77 ms
6,944 KB
testcase_15 AC 80 ms
6,940 KB
testcase_16 AC 80 ms
6,944 KB
testcase_17 AC 84 ms
6,944 KB
testcase_18 AC 83 ms
6,940 KB
testcase_19 AC 86 ms
6,940 KB
testcase_20 AC 67 ms
6,940 KB
testcase_21 AC 68 ms
6,940 KB
testcase_22 AC 43 ms
6,944 KB
testcase_23 AC 83 ms
7,000 KB
testcase_24 AC 76 ms
6,996 KB
testcase_25 AC 43 ms
6,944 KB
testcase_26 AC 33 ms
6,940 KB
testcase_27 AC 64 ms
6,944 KB
testcase_28 AC 68 ms
6,944 KB
testcase_29 AC 53 ms
6,940 KB
testcase_30 AC 58 ms
7,012 KB
testcase_31 AC 65 ms
7,016 KB
testcase_32 AC 67 ms
7,020 KB
testcase_33 AC 60 ms
7,012 KB
testcase_34 AC 77 ms
7,148 KB
testcase_35 AC 72 ms
7,016 KB
testcase_36 AC 57 ms
7,012 KB
testcase_37 AC 68 ms
7,016 KB
testcase_38 AC 62 ms
7,012 KB
testcase_39 AC 65 ms
7,144 KB
testcase_40 AC 86 ms
7,012 KB
testcase_41 AC 84 ms
7,016 KB
testcase_42 AC 82 ms
7,012 KB
testcase_43 AC 85 ms
7,144 KB
testcase_44 AC 87 ms
7,016 KB
testcase_45 AC 87 ms
7,140 KB
testcase_46 AC 85 ms
7,144 KB
testcase_47 AC 84 ms
7,016 KB
testcase_48 AC 89 ms
7,012 KB
testcase_49 AC 82 ms
7,016 KB
testcase_50 AC 85 ms
7,016 KB
testcase_51 AC 83 ms
7,144 KB
testcase_52 AC 86 ms
7,016 KB
testcase_53 AC 83 ms
7,012 KB
testcase_54 AC 86 ms
7,004 KB
testcase_55 AC 87 ms
7,020 KB
testcase_56 AC 88 ms
7,016 KB
testcase_57 AC 85 ms
7,016 KB
testcase_58 AC 85 ms
7,016 KB
testcase_59 AC 85 ms
7,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001

int main(){
	int _t;
	cin>>_t;
	rep(_,_t){
		long long N,K,X;
		cin>>N>>K>>X;
		vector<long long> h(N);
		rep(i,N)cin>>h[i];
		vector<long long> d(1,h[0]);
		rep(i,N-1){
			d.push_back(h[i+1]-h[i]);
		}
		d.push_back(-h[N-1]);
		bool f=  true;
		rep(i,K){
			bool F0 = false,F1 = false;
			long long sum = 0;
			set<long long> s;
			for(int j=i;j<=N;j+=K){
				if(j==0){
					F0 = true;
					continue;
				}
				if(j==N){
					F1 = true;
					continue;
				}
				sum += d[j];
				{
					long long dd = d[j];
					dd %= X;
					if(dd<0)dd+=X;
					s.insert(dd);
					if(s.size()>=2){
						f= false;
						break;
					}
				}
			}
			if(!f)break;
			if(sum==0)continue;
			if(sum>0 && !F0){
				f = false;
				break;
			}
			if(sum<0 && !F1){
				f = false;
				break;
			}
		}
		if(f)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
    return 0;
}
0