## Codeforces Round #416 (Div. 2), problem: (E) Vladik and Entertaining Flags Solution In C/C++

By |2017-07-24T17:24:20+06:00July 24th, 2017|Categories: Uncategorized||

#include<set> #include<map> #include<cmath> #include<queue> #include<cctype> #include<vector> #include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define Rep(i,x,y) for(int i=x;i<y;++i) #define For(i,x,y) for(int i=x;i<=y;++i) #define Forn(i,x,y) for(int i=x;i>=y;--i) const int N = 1e5+5; typedef [...]

## Codeforces Round #416 (Div. 2), problem: (C) Vladik and Memorable Trip Solution In C/C++

By |2017-07-24T17:21:24+06:00July 24th, 2017|Categories: Uncategorized||

#include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int n,a[5005],c[5005],f[5005]; scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",a+i),c[a[i]]++; for(int i=0;i<n;i++){ int v[5005]={0},temp=0,xo=0; for(int j=i;j>=0;j--){ if(v[a[j]]==0)v[a[j]]=1,temp+=c[a[j]],xo^=a[j]; f[i+1]=max(f[i+1],f[j]+(--temp?0:xo)); } } printf("%d",f[n]); return 0; }

## Codeforces Round #416 (Div. 2), problem: (B) Vladik and Complicated Book Solution In C/C++

By |2017-07-24T17:19:49+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<cstdio> int p[10001],n,m,l,r,x; int main(){ scanf("%d%d",&n,&m); for(x=1;x<=n;x++)scanf("%d",&p[x]); for(;m--;){ scanf("%d%d%d",&l,&r,&x); for(n=l;n<=r;n++)if(p[n]<p[x])l++; printf("%s\n",l==x?"Yes":"No"); } return 0; }

## Codeforces Round #416 (Div. 2), problem: (A) Vladik and Courtesy Solution in C/C++

By |2017-07-24T17:18:07+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; int main() { long a,b; cin>>a>>b; a=sqrt(a); if(a*(a+1)>b)cout<<"Valera"; else cout<<"Vladik"; }