当前位置:网站首页>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;
}
边栏推荐
- How do the top ten securities firms open accounts? Also, is it safe to open an account online?
- Restcloud ETL实践之数据行列转换
- halcon数组的一些使用
- 如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
- 股票开账户如何优惠开户?还有,在线开户安全么?
- SWT / anr problem - anr/je causes SWT
- 联想X86服务器重启管理控制器(XClarity Controller)或TSM的方法
- 鼠标悬停效果五
- I want to know how to open a stock account? Is it safe to open an account online?
- SWT/ANR问题--StorageManagerService卡住
猜你喜欢
![[2022] Jiangxi postgraduate mathematical modeling scheme and code](/img/f4/86b0dc2bd49c3a54c1e0538b31d458.png)
[2022] Jiangxi postgraduate mathematical modeling scheme and code

记一次服务部署失败问题排查

Pycharm 打开远程目录 Remote Host

Restcloud ETL实践之数据行列转换
![Pytorch - - Basic Reference North Deux élèves du secondaire peuvent comprendre [Rétropropagation et Gradient descendant]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch - - Basic Reference North Deux élèves du secondaire peuvent comprendre [Rétropropagation et Gradient descendant]

运算符重载的初识

Focusing on green and low carbon, data center cooling has entered a new era of "intelligent cooling"

nacos配置中心使用教程

Pychar open remote directory remote host

联想X86服务器重启管理控制器(XClarity Controller)或TSM的方法
随机推荐
Applet custom top navigation bar, uni app wechat applet custom top navigation bar
Clickhouse eliminates the gap caused by group by
pycharm 软件deployment 灰色 无法点
LabVIEW calculates the camera image sensor resolution and lens focal length
Image preloading in JS
现在开户有优惠吗?另外,手机开户安全么?
Analysis and solution of anr problems
SWT/ANR问题--Native方法执行时间过长导致SWT
SWT / anr problem - deadlock
In the industrial Internet, "small" programs have "big" effects
鼠标悬停效果六
Leetcode(524)——通过删除字母匹配到字典里最长单词
Contrastive learning of Class-agnostic Activation Map for Weakly Supervised Object Localization and
import tensorflow. contrib. Slim as slim error
鼠标悬停效果五
Qu'est - ce que le PMP?
开源基础软件公司,寻找一起创造未来的你(API7.ai)
我想知道股票开户怎么开户?究竟网上开户是否安全么?
Pulsar Geo Replication/灾备/地域复制
详解数据治理知识体系