题目 题意: 给定数组a,可以执行任意次操作。选定数组中任意一个数a[i],令整个数组均执行^a[i].执行完操作后数组a的最大和。 思路: 可以证明不执行操作和执行操作1次包含了所有情况。
时间复杂度: O(nlogn) 代码:
// Problem: C - XOR to All
// Contest: AtCoder - AtCoder Regular Contest 135
// URL: https://atcoder.jp/contests/arc135/tasks/arc135_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define OldTomato ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define fir(i,a,b) for(int i=a;i
关注
打赏