当前位置:网站首页>Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
Codeforces Round #416 (Div. 2) C. Vladik and Memorable Trip
2022-07-01 02:24:00 【不吃土司边】
#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;
}
边栏推荐
- 十大券商有哪些?另外想问,现在在线开户安全么?
- 查看 jvm 参数
- Restcloud ETL实践之数据行列转换
- 详解数据治理知识体系
- AI edge computing platform - beaglebone AI 64 introduction
- halcon变量窗口的图像变量不显示,重启软件和电脑都没用
- How do I open an account on my mobile phone? 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?
- C # generates PPK files in putty format (supports passphrase)
- House change for agricultural products? "Disguised" house purchase subsidy!
猜你喜欢

VirtualBox installation enhancements

Int and bit group turn to each other

(翻译)使用眉状文本提高标题点击率

Pycharm 打开远程目录 Remote Host

Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。

What is project management?
![Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]

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

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

Machine learning 10 belief Bayesian classifier
随机推荐
C#生成putty格式的ppk文件(支持passphrase)
Pychar open remote directory remote host
Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
RocketQA:通过跨批次负采样(cross-batch negatives)、去噪的强负例采样(denoised hard negative sampling)与数据增强(data augment
(translation) reasons why real-time inline verification is easier for users to make mistakes
Static domain and static method
查看 jvm 参数
Template: globally balanced binary tree
Windows quick add boot entry
Alphabet-Rearrange-Inator 3000(字典树自定义排序)
[proteus simulation] Arduino UNO +74c922 keyboard decoding drive 4x4 matrix keyboard
SWT/ANR问题--StorageManagerService卡住
Fix names in the table (first character uppercase, other lowercase)
LabVIEW计算相机图像传感器分辨率以及镜头焦距
@The difference between configurationproperties and @value
SWT/ANR问题--Binder Stuck
CorelDRAW 2022中文精简64位直装版下载
SWT / anr problem - anr/je causes SWT
Clickhouse eliminates the gap caused by group by
[multi source BFS] 934 Shortest Bridge