当前位置:网站首页>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;
}
边栏推荐
- go: finding module for package
- AI edge computing platform - beaglebone AI 64 introduction
- [2022] Jiangxi postgraduate mathematical modeling scheme and code
- nacos配置中心使用教程
- CentOS installs multiple versions of PHP and switches
- 5款主流智能音箱入门款测评:苹果小米华为天猫小度,谁的表现更胜一筹?
- Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
- 522. Longest special sequence II
- I want to know how to open a stock account? Is it safe to open an account online?
- 鼠标悬停效果六
猜你喜欢

Image preloading in JS

Ernie gram, an explicit and complete n-gram mask language model, implements explicit n-gram semantic unit knowledge modeling.

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

Applet custom top navigation bar, uni app wechat applet custom top navigation bar

Machine learning 9-universal approximator radial basis function neural network, examining PDA and SVM from a new perspective

How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?

Leetcode interview question 17.10 Main elements

RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment

Pycharm 打开远程目录 Remote Host

LabVIEW calculates the camera image sensor resolution and lens focal length
随机推荐
UE4渲染管线学习笔记
Pulsar 主题压缩
SWT / anr problem - storagemanagerservice stuck
开源基础软件公司,寻找一起创造未来的你(API7.ai)
SWT/ANR问题--Deadlock
halcon数组的一些使用
[multi source BFS] 934 Shortest Bridge
[punch in questions] integrated daily 5 questions sharing (phase I)
In the industrial Internet, "small" programs have "big" effects
联想X86服务器重启管理控制器(XClarity Controller)或TSM的方法
Applet custom top navigation bar, uni app wechat applet custom top navigation bar
nacos配置中心使用教程
我想知道股票开户怎么开户?究竟网上开户是否安全么?
项目管理是什么?
如果我在北京,到哪里开户比较好?另外,手机开户安全么?
522. Longest special sequence II
记一次服务部署失败问题排查
Pulsar Geo Replication/灾备/地域复制
鼠标悬停效果八
JS anti shake and throttling