結果

問題 No.862 XORでX
ユーザー 👑 kmjpkmjp
提出日時 2019-08-09 23:05:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,395 bytes
コンパイル時間 1,791 ms
コンパイル使用メモリ 172,404 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-09-26 21:44:44
合計ジャッジ時間 9,962 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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(X%4==0) {
		X/=4;
		if(N>=4) {
			V.push_back(1);
			V.push_back(2);
			V.push_back(3);
			V.push_back(N);
			X--;
			for(i=4;i<=100000;i+=4) if(X) {
				if(N<i || i+4<=N) {
					V.push_back(i);
					V.push_back(i+1);
					V.push_back(i+2);
					V.push_back(i+3);
					X--;
				}
			}
		}
		else {
			assert(0);
		}
	}
	if(X%4==1) {
		X--;
		V.push_back(N);
		X/=4;
		for(i=4;i<=100000;i+=4) if(X) {
			if(N<i || i+4<=N) {
				V.push_back(i);
				V.push_back(i+1);
				V.push_back(i+2);
				V.push_back(i+3);
				X--;
			}
		}
	}
	if(X%4==2) {
		assert(0);
	}
	if(X%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