結果
| 問題 |
No.862 XORでX
|
| コンテスト | |
| ユーザー |
pockyny
|
| 提出日時 | 2019-08-10 02:56:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 2,000 ms |
| コード長 | 1,061 bytes |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 68,064 KB |
| 最終ジャッジ日時 | 2025-01-07 11:37:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#include <iostream>
using namespace std;
int main(){
int i,j,n,x,y = 0;
cin >> n >> x;
for(i=4;i<=100000;i+=4){
if(i==x/4*4) continue;
if(n<=4) break;
for(j=0;j<4;j++){
cout << i + j << endl;
y ^= i + j;
}
n -= 4;
}
if(n==1){
cout << x << endl;
}
if(n==2){
if(x>1){
cout << (x^1) << endl;
cout << 1 << endl;
}else{
cout << 2 << endl;
cout << 3 << endl;
}
}
if(n==3){
if(x>3){
cout << (x^3) << endl;
cout << 1 << endl;
cout << 2 << endl;
}else{
if(x>1){
cout << (100000^x) << endl;
cout << 100001 << endl;
cout << 1 << endl;
}else{
cout << (100000^x) << endl;
cout << 100002 << endl;
cout << 2 << endl;
}
}
}
if(n==4){
if(x>3){
cout << x << endl;
cout << 1 << endl;
cout << 2 << endl;
cout << 3 << endl;
}else{
if(x<3){
cout << x << endl;
cout << 3 << endl;
cout << 100001 << endl;
cout << 100002 << endl;
}else{
cout << x << endl;
cout << 100003 << endl;
cout << 100001 << endl;
cout << 2 << endl;
}
}
}
}
pockyny