結果

問題 No.862 XORでX
ユーザー 👑 kmjpkmjp
提出日時 2019-08-09 23:07:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,410 bytes
コンパイル時間 1,750 ms
コンパイル使用メモリ 171,836 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-26 21:48:03
合計ジャッジ時間 8,842 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 RE -
testcase_04 AC 2 ms
4,380 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 125 ms
4,380 KB
testcase_21 AC 120 ms
4,380 KB
testcase_22 AC 120 ms
4,380 KB
testcase_23 AC 121 ms
4,380 KB
testcase_24 AC 119 ms
4,376 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 121 ms
4,376 KB
testcase_31 AC 119 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#undef _P
#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 ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,X;
vector<int> V;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X;
	if(N%4==0) {
		N/=4;
		if(X>=4) {
			V.push_back(1);
			V.push_back(2);
			V.push_back(3);
			V.push_back(X);
			N--;
			for(i=4;i<=100000;i+=4) if(N) {
				if(X<i || i+4<=X) {
					V.push_back(i);
					V.push_back(i+1);
					V.push_back(i+2);
					V.push_back(i+3);
					N--;
				}
			}
		}
		else {
			assert(0);
		}
	}
	else if(N%4==1) {
		N--;
		V.push_back(X);
		N/=4;
		for(i=4;i<=100000;i+=4) if(N) {
			if(X<i || X>=i+4) {
				V.push_back(i);
				V.push_back(i+1);
				V.push_back(i+2);
				V.push_back(i+3);
				N--;
			}
		}
	}
	else if(N%4==2) {
		assert(0);
	}
	else if(N%4==3) {
		assert(0);
	}
	sort(ALL(V));
	FORR(x,V) cout<<x<<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