【瞎搞】 Codeforces 460D Little Victor and Set 位运算构造
来源:互联网 发布:淘宝钱柜数码 编辑:程序博客网 时间:2024/05/21 21:01
点击打开链接
L^L==0
L为偶数时
L^(L+1)^(L+2)^(L+3)==0
L^(L+1)==1
#include <cstdio>#include <cstring>#include <cstdlib>#include <string>#include <iostream>#include <algorithm>#include <sstream>#include <cmath>using namespace std;#include <queue>#include <stack>#include <vector>#include <deque>#include <set>#include <map>#define cler(arr, val) memset(arr, val, sizeof(arr))typedef long long LL;const int MAXN = 150100;const int MAXM = 11111;const int INF = 0x3f3f3f3f;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1int main(){ LL l,r,k; cin>>l>>r>>k; if(k>=4) { if((l&1)&&(r-l)>=4) { cout<<0<<endl; cout<<4<<endl; cout<<l+1<<" "<<l+2<<" "<<l+3<<" "<<l+4<<endl; return 0; } else if(!(l&1)) { cout<<0<<endl; cout<<4<<endl; cout<<l<<" "<<l+1<<" "<<l+2<<" "<<l+3<<endl; return 0; } } if(k>=3) { LL tol=0,tp=l; while(tp) { tp>>=1; ++tol; } tp=(LL)3<<(tol-1); if(tp<=r) { cout<<0<<endl; cout<<3<<endl; cout<<tp<<" "<<l<<" "<<(tp^l)<<endl; return 0; } } if(k>=2) { if((l&1) && r-l>=2) { cout<<1<<endl; cout<<2<<endl; cout<<l+1<<" "<<l+2<<endl; return 0; } else if(!(l&1)) { cout<<1<<endl; cout<<2<<endl; cout<<l<<" "<<l+1<<endl; return 0; } else if((l^r)<l) { cout<<(l^r)<<endl; cout<<2<<endl; cout<<l<<" "<<r<<endl; return 0; } } if(k>=1) { cout<<l<<endl; cout<<1<<endl; cout<<l<<endl; return 0; }}
0 0
- 【瞎搞】 Codeforces 460D Little Victor and Set 位运算构造
- Codeforces 460D Little Victor and Set(构造)
- codeforces #460D Little Victor and Set 构造
- codeforces 460D Little Victor and Set(构造)
- [Codeforces 460D] Little Victor and Set (构造)
- codeforces 460D Little Victor and Set(构造)
- Codeforces 460 D. Little Victor and Set
- Codeforces Round #262 (Div. 2) D Little Victor and Set
- Codeforces 460d Littel victor and set
- [Codeforces460D] Little Victor and Set(构造)
- 【Codeforces Round 262 (Div 2)D】【构造】Little Victor and Set 集合最多取k数使得异或值尽可能小
- CF 262Div2 D Little Victor and Set
- CodeForces 276 D.Little Girl and Maximum XOR(位运算)
- Codeforces 276D Little Girl and Maximum XOR 贪心+构造
- Codeforces 367D Sereja and Sets 位运算暴力
- 【Codeforces 367D 】Sereja and Sets 位运算
- [CodeForces 276D] Little Girl and Maximum XOR (构造+脑洞)
- codeforces 221D Little Elephant and Array
- win7 运行PB5 SYSGEN无响应解决
- Android Support兼容包详解
- 回收全国倒闭化工厂的化工原料及废旧化工品13403306214专业评估
- Data Structures and Algorithm Analysis in c++ 第一章笔记和部分习题
- log4j 按时间、大小产生新的日志文件【转】
- 【瞎搞】 Codeforces 460D Little Victor and Set 位运算构造
- iOS —— QQ中未读气泡拖拽消失的实现
- 黑马程序员------c.全局变量
- 工作区和暂存区
- POJ 题目2127 Greatest Common Increasing Subsequence(LICS,输出路径)
- 泛型
- Android动画之Interpolator和AnimationSet
- MapReduce工作原理图文详解
- UIView详解