結果
| 問題 |
No.862 XORでX
|
| コンテスト | |
| ユーザー |
ttttan2
|
| 提出日時 | 2019-08-10 00:04:13 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 2,000 ms |
| コード長 | 2,722 bytes |
| コンパイル時間 | 1,459 ms |
| コンパイル使用メモリ | 162,444 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 16:02:31 |
| 合計ジャッジ時間 | 5,260 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
if(a<b)return b;
else return a;
}
ll lmin(ll a,ll b){
if(a<b)return a;
else return b;
}
int main(){
ll n,x;cin>>n>>x;
vector<ll> ans;
ll now=n;
ll k=(x/4)*4;
for(int i=4;;i+=4){
if(now<=4)break;
if(i<x&&i+4>x)continue;
if(i==x)continue;
rep(j,0,4)ans.push_back(i+j);
now-=4;
}
if(now%4==0){
if(x>=4){
rep(i,0,3) ans.push_back(i+1);
ans.push_back(x);
}
else{
if(x!=3){
ans.push_back(100001);
ans.push_back(100002);
ans.push_back(3);
ans.push_back(x);
}
else{
ans.push_back(100003);
ans.push_back(100001);
ans.push_back(2);
ans.push_back(3);
}
}
}
else if(now%4==1){
ans.push_back(x);
}
else if(now%4==2){
if(x>=4){
if(k!=x){
ans.push_back(k);
ans.push_back(x);
}
else{
ans.push_back(k+1);
ans.push_back(1);
}
}
else{
rep(j,1,4){
if(j!=x)ans.push_back(j);
}
}
}
else if(now%4==3){
if(x>=4){
if(k!=x){
ans.push_back(k);
ll u=k^x;
rep(j,1,4)if(j!=u)ans.push_back(j);
}
else{
ans.push_back(k+3);
ans.push_back(1);
ans.push_back(2);
}
}
else{
if(x!=3){
ans.push_back(100001);
ans.push_back(100002);
if(x==1)ans.push_back(2);
if(x==2)ans.push_back(1);
}
else{
ans.push_back(100000);
ans.push_back(100001);
ans.push_back(2);
}
}
}
ll sum=0;
rep(i,0,ans.size()){
cout<<ans[i]<<endl;
sum^=ans[i];
}
//cout<<sum<<endl;
}
ttttan2