結果

問題 No.2658 L-R Nim
ユーザー 👑 kmjpkmjp
提出日時 2024-03-03 22:31:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,465 bytes
コンパイル時間 2,358 ms
コンパイル使用メモリ 214,280 KB
実行使用メモリ 522,188 KB
最終ジャッジ日時 2024-03-03 22:33:04
合計ジャッジ時間 80,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,616 KB
testcase_01 AC 3 ms
7,616 KB
testcase_02 AC 3 ms
7,616 KB
testcase_03 AC 4 ms
7,616 KB
testcase_04 AC 2 ms
7,616 KB
testcase_05 AC 305 ms
93,576 KB
testcase_06 AC 406 ms
93,576 KB
testcase_07 AC 304 ms
93,448 KB
testcase_08 AC 305 ms
93,448 KB
testcase_09 AC 390 ms
93,576 KB
testcase_10 AC 391 ms
93,448 KB
testcase_11 AC 375 ms
93,576 KB
testcase_12 AC 393 ms
93,576 KB
testcase_13 AC 415 ms
93,576 KB
testcase_14 AC 389 ms
93,448 KB
testcase_15 AC 303 ms
93,576 KB
testcase_16 AC 415 ms
93,576 KB
testcase_17 AC 388 ms
93,448 KB
testcase_18 AC 388 ms
93,576 KB
testcase_19 AC 413 ms
93,448 KB
testcase_20 AC 320 ms
93,448 KB
testcase_21 AC 390 ms
93,576 KB
testcase_22 AC 416 ms
93,576 KB
testcase_23 AC 302 ms
93,576 KB
testcase_24 AC 339 ms
93,576 KB
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 MLE -
testcase_30 MLE -
testcase_31 MLE -
testcase_32 MLE -
testcase_33 AC 1,600 ms
319,216 KB
testcase_34 MLE -
testcase_35 AC 1,352 ms
333,808 KB
testcase_36 MLE -
testcase_37 AC 1,386 ms
383,088 KB
testcase_38 MLE -
testcase_39 MLE -
testcase_40 MLE -
testcase_41 MLE -
testcase_42 MLE -
testcase_43 MLE -
testcase_44 MLE -
testcase_45 MLE -
testcase_46 MLE -
testcase_47 MLE -
testcase_48 MLE -
testcase_49 MLE -
testcase_50 MLE -
testcase_51 MLE -
testcase_52 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N,K,A[101010];
set<int> S[50505];
vector<int> cand;
int X[50505];
int M[2<<20];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N) {
		cin>>A[i];
		X[i+1]=X[i]^A[i];
		for(j=-K;j<=K;j++) if(A[i]+j>=1) {
			S[i].insert(A[i]^(A[i]+j));
			cand.push_back(A[i]^(A[i]+j));
		}
	}
	sort(ALL(cand));
	cand.erase(unique(ALL(cand)),cand.end());
	
	FORR(c,cand) {
		int num=0;
		FOR(i,N+1) {
			if(M[X[i]]++==0) num++;
		}
		
		for(i=N-1;i>=0;i--) {
			if(--M[X[i+1]]==0) num--;
			if(M[X[i+1]^c]++==0) num++;
			if(num==N+1&&S[i].count(c)) {
				cout<<"Yes"<<endl;
				return;
			}
		}
		M[0]--;
		FOR(i,N) M[X[i+1]^c]=0;
	}
	cout<<"No"<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0