当前位置:网站首页>Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
2022-07-01 02:33:00 【Don't eat toast】
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
const int maxn = 1e5+2;
const int INF = 1<<30;
const int mod = 1e9+7;
int dp[maxn],n,a[maxn];
int cnt[maxn],cnt2[maxn];
int res[maxn];
void solve(){
;
scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d",&a[i]),cnt[a[i]]++;
for(int i=1;i<=n;i++){
int now=0,now2=0;
memset(cnt2,0,sizeof cnt2);
for(int j=i;j>=1;j--){
if(cnt2[a[j]]==0) now++,now2^=a[j];
cnt2[a[j]]++;
if(cnt2[a[j]]==cnt[a[j]]) --now;
if(!now){
res[i]=max(res[i],res[j-1]+now2);
}
}
res[i]=max(res[i],res[i-1]);
}
cout<<res[n]<<endl;
return;
}
int main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
- Thread Detach
- Alphabet rearrange inator 3000 (dictionary tree custom sorting)
- Résumé des styles de développement d'applets Wechat
- Pychar open remote directory remote host
- Qu'est - ce que le PMP?
- Thread Detach
- 7_OpenResty安装
- 园区运营效率提升,小程序容器技术加速应用平台化管理
- Find the length of the common part of two line segments
- How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
猜你喜欢

CentOS installs multiple versions of PHP and switches

Rocketqa: cross batch negatives, de noised hard negative sampling and data augmentation
![Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]

What is project management?

Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)

(总结一)Halcon基础之寻找目标特征+转正
![Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]

Restcloud ETL实践之数据行列转换

Desai wisdom number - other charts (parallel coordinate chart): employment of fresh majors in 2021

记一次服务部署失败问题排查
随机推荐
PMP是什么?
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
[multi source BFS] 934 Shortest Bridge
SWT/ANR问题--Native方法执行时间过长导致SWT
开源基础软件公司,寻找一起创造未来的你(API7.ai)
手机上怎么开户?还有,在线开户安全么?
Sampling Area Lights
Gartner研究:在中国,混合云的采用已成为主流趋势
详解数据治理知识体系
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]
What are the top ten securities companies? In addition, is it safe to open an account online now?
Proxy support and SNI routing of pulsar
How do the top ten securities firms open accounts? Also, is it safe to open an account online?
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
鼠标悬停效果八
SWT/ANR问题--StorageManagerService卡住
How to use Jieba participle in unity
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]
What is the difference between port number and process number?
(总结一)Halcon基础之寻找目标特征+转正