当前位置:网站首页>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;
}
边栏推荐
- 手机上怎么开户?还有,在线开户安全么?
- Pychart software deployment gray unable to point
- SWT / anr problem - deadlock
- RestCloud ETL实践之无标识位实现增量数据同步
- SWT / anr problem - storagemanagerservice stuck
- SWT/ANR问题--Dump时间过长导致的SWT
- Map array function
- 鼠标悬停效果四
- In the industrial Internet, "small" programs have "big" effects
- 【PR #5 A】双向奔赴(状压DP)
猜你喜欢
Pytorch - - Basic Reference North Deux élèves du secondaire peuvent comprendre [Rétropropagation et Gradient descendant]
Sampling Area Lights
如何在智汀中實現智能鎖與燈、智能窗簾電機場景聯動?
DenseNet网络论文学习笔记
Small program cloud development -- wechat official account article collection
SWT/ANR问题--StorageManagerService卡住
@ConfigurationProperties和@Value的区别
(summary I) Halcon Foundation's target finding features + becoming a regular
pycharm 软件deployment 灰色 无法点
[JS] [Nuggets] get people who are not followers
随机推荐
旷世轻量化网络ShuffulNetV2学习笔记
RestCloud ETL实践之无标识位实现增量数据同步
Detailed data governance knowledge system
I want to know how to open a stock account? Is it safe to open an account online?
What is PMP?
How to add a condition for an associated table in an SQL statement [null value required or not required]
开源基础软件公司,寻找一起创造未来的你(API7.ai)
SWT/ANR问题--AMS/WMS
鼠标悬停效果七
Xception学习笔记
鼠标悬停效果四
Cluster method synchronous execution framework suona
JS anti shake and throttling
使用ipmitool配置X86服务器的BMC网络和用户信息
【微信小程序開發】樣式匯總
十大劵商如何开户?还有,在线开户安全么?
How do the top ten securities firms open accounts? Also, is it safe to open an account online?
What are the top ten securities companies? In addition, is it safe to open an account online now?
[graduation season · advanced technology Er] - summary from graduation to work
Leetcode (524) -- match the longest word in the dictionary by deleting letters