結果
| 問題 | 
                            No.862 XORでX
                             | 
                    
| コンテスト | |
| ユーザー | 
                             QCFium
                         | 
                    
| 提出日時 | 2019-08-09 23:32:43 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 760 bytes | 
| コンパイル時間 | 1,621 ms | 
| コンパイル使用メモリ | 173,636 KB | 
| 実行使用メモリ | 8,448 KB | 
| 最終ジャッジ日時 | 2024-07-19 15:55:20 | 
| 合計ジャッジ時間 | 8,633 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 2 | 
| other | AC * 18 WA * 10 | 
ソースコード
#include <bits/stdc++.h>
int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
uint32_t xorshift() {
	static uint32_t x = 2463534242;
	x ^= x << 13;
	x ^= x >> 17;
	x ^= x << 15;
	return x;
}
int main() {
	int n = ri(), x = ri();
	bool inv = false;
	if (n >= 50000) n = 100005 - n, inv = true, x ^= 1;
	
	while (1) {
		std::set<int> all;
		int xorr = x;
		for (int i = 0; i + 1 < n; i++) {
			int cur;
			do cur = xorshift() % 100005 + 1; while (all.count(cur));
			all.insert(cur);
			xorr ^= cur;
		}
		if (!all.count(xorr)) {
			all.insert(xorr);
			if (inv) {
				for (int i = 1; i <= 100005; i++) {
					if (all.count(i)) all.erase(i);
					else all.insert(i);
				}
			}
			for (auto i : all) std::cout << i << std::endl;
			return 0;
		}
	}
	
	return 0;
}
            
            
            
        
            
QCFium