根据题目要求可以发现,要使得总和尽可能地小,应尽可能将选择的 ( a i , a j ) (a_i, a_j) (ai,aj)变为 ( a i ∣ a j , 0 ) (a_i | a_j, 0) (ai∣aj,0)。那么统计 1 1 1的位数求和或直接所有元素求或即可。
#include
#define int long long
inline void solve(){
int ans = 0, n = 0; std::cin >> n;
for(int i = 1; i > x;
ans |= x;
}
std::cout n;
memset(book, 0, sizeof book);
for(int i = 1; i > a[i];
for(int i = 2; i a[i - 1] && a[i] > a[i + 1]){
a[i] = max(a[i + 1], a[i + 2]);
cnt++;
}
}
cout
关注
打赏
- 回坑记之或许是退役赛季?
- [LCT刷题] P1501 [国家集训队]Tree II
- [LCT刷题] P2147 洞穴勘测
- 2022-2023 ICPC Brazil Subregional Programming Contest VP记录
- [线段树套单调栈] 2019-2020 ICPC Asia Hong Kong Regional Contest H.[Hold the Line]
- The 2021 ICPC Asia Nanjing Regional Contest E.Paimon Segment Tree 区间合并线段树/维护矩阵乘法
- CF580E - Kefa and Watch 线段树维护哈希
- HDU5869 Different GCD Subarray Query 离线查询/区间贡献
- 27.CF1004F Sonya and Bitwise OR 区间合并线段树
- 26.CF1000F One Occurrence