当前位置:网站首页>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;
}
边栏推荐
- Proxy support and SNI routing of pulsar
- 使用ipmitool配置X86服务器的BMC网络和用户信息
- 7_OpenResty安装
- Sampling Area Lights
- Pychar open remote directory remote host
- SWT / anr issues - ams/wms
- What are the top ten securities companies? In addition, is it safe to open an account online now?
- VirtualBox installation enhancements
- Restcloud ETl数据通过时间戳实现增量数据同步
- In the industrial Internet, "small" programs have "big" effects
猜你喜欢
Applet custom top navigation bar, uni app wechat applet custom top navigation bar
5款主流智能音箱入门款测评:苹果小米华为天猫小度,谁的表现更胜一筹?
如何在智汀中實現智能鎖與燈、智能窗簾電機場景聯動?
SWT/ANR问题--Binder Stuck
js中的图片预加载
详解数据治理知识体系
Pulsar geo replication/ disaster recovery / regional replication
产业互联网中,「小」程序有「大」作为
How to add a condition for an associated table in an SQL statement [null value required or not required]
Pytorch —— 基礎指北_貳 高中生都能看懂的[反向傳播和梯度下降]
随机推荐
halcon变量窗口的图像变量不显示,重启软件和电脑都没用
运算符重载的初识
js中的图片预加载
Map array function
Do you write API documents or code first?
手机edge浏览器无法打开三方应用
Résumé des styles de développement d'applets Wechat
A preliminary understanding of operator overloading
Detailed data governance knowledge system
Leetcode interview question 17.10 Main elements
(summary I) Halcon Foundation's target finding features + becoming a regular
Rocketqa: cross batch negatives, de noised hard negative sampling and data augmentation
【PR #5 A】双向奔赴(状压DP)
How to use Jieba participle in unity
SAP ALV summary is inconsistent with exported excel summary data
Restcloud ETl数据通过时间戳实现增量数据同步
CentOS installs multiple versions of PHP and switches
Gartner研究:在中国,混合云的采用已成为主流趋势
基于OPENCV和图像减法的PCB缺陷检测
I want to know how to open a stock account? Is it safe to open an account online?