Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (G) Replace All Solution In C/C++

By |2017-07-24T16:43:42+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , |

#include<set> #include<map> #include<ctime> #include<cmath> #include<queue> #include<bitset> #include<string> #include<cstdio> #include<cctype> #include<vector> #include<cstdlib> #include<cstring> #include<cassert> #include<sstream> #include<numeric> #include<iostream> #include<algorithm> #include<functional> using namespace std; #define For(i,x,y) for(int i=x,_y=y;i<=_y;++i) #define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i) #define pub push_back #define pob pop_back #define fi first #define se second #define mp make_pair [...]

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (F) Leha and security system Solution In C/C++

By |2017-07-24T16:42:09+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , |

#include <cstdio> #include <iostream> #include <algorithm> #define N 100010 using namespace std; typedef long long ll; int n,m; int a[N]; struct segt{ int l,r,cd; int f[10],lazy[10]; ll sum[10]; ll val(){ ll ret=0; for(int i=0;i<10;i++) ret+=sum[i]*i; return ret; } }T[N<<2]; inline char nc(){ static char [...]

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (E) Choosing Carrot Solution In C/C++

By |2017-07-24T16:40:56+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; int a[333333],b[333333]; int main() { int n,i,x,y; cin>>n; for(i=1;i<=n;i=i+1) cin>>a[i]; for(i=1;i<=n;i=i+1) { x=(i-1)-(n-i); if(x<0) x=-x; b[x]=max(b[x],a[i]); } for(i=1;i<n;i=i+1) { x=(i-1)-(n-i-1); if(x<0) x=-x; b[x]=max(b[x],min(a[i],a[i+1])); } for(i=2;i<=n;i=i+1) b[i]=max(b[i],b[i-2]); for(i=1;i<n;i=i+1) cout<<b[i]<<' '; cout<<b[n-1]<<endl; [...]

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (D) Labelling Cities Solution In C/C++

By |2017-07-24T16:39:18+00:00July 24th, 2017|Categories: Uncategorized|Tags: , , , , , , , , , |

#include<bits/stdc++.h> #define MAXN 300100 using namespace std; struct node{int y,next;}e[MAXN<<1]; int n,m,len,Link[MAXN],p[MAXN],hash[MAXN],col[MAXN],vis[MAXN],used[MAXN<<1]; inline int read(){ int x=0,f=1; char ch=getchar(); while(!isdigit(ch)) {if(ch=='-') f=-1; ch=getchar();} while(isdigit(ch)) {x=x*10+ch-'0'; ch=getchar();} return x*f; } void insert(int x,int y){e[++len].next=Link[x];Link[x]=len;e[len].y=y;} void dfs(int x){ vis[x]=1; for(int i=Link[x];i;i=e[i].next)if(hash[e[i].y]==hash[x])col[e[i].y]=col[x]; for(int i=Link[x];i;i=e[i].next)if(!vis[e[i].y]){ if(!col[e[i].y]){ for(int j=col[x]-1;j<=col[x]+1;++j)if(!used[j]){ [...]

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (C) Naming Company Solution In C/C++

By |2017-07-24T16:37:59+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MN 300000 char a[MN+5],b[MN+5],c[MN+5]; bool cmp(char x,char y){return x>y;} int main() { int n,i,al,ar,bl,br,cl,cr; scanf("%s%s",a,b); n=strlen(a); sort(a,a+n);sort(b,b+n,cmp); al=0;ar=n+1>>1;bl=0;br=n>>1;cl=0;cr=n; for(i=0;i<n;++i) if(i&1) if(b[bl]>a[al])c[cl++]=b[bl++]; else c[--cr]=b[--br]; else if(a[al]<b[bl])c[cl++]=a[al++]; else c[--cr]=a[--ar]; puts(c); }

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (B) Cutting Carrot Solution In C/C++

By |2017-07-24T16:36:27+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<bits/stdc++.h> int main(){double p,l,i=1;std::cin>>p>>l;for(;i<p;)printf("%.7f ",sqrt(i++/p)*l);}

Tinkoff Challenge – Final Round (Codeforces Round #414, rated, Div. 1 + Div. 2), problem: (A) Bank Robbery Solution in C/C++

By |2017-07-24T16:34:58+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<cstdio> int main() { int a,b,c,i,ans=0; scanf("%d%d%d",&a,&b,&c); for(scanf("%d",&i);i--;)scanf("%d",&a),a>b&&a<c?++ans:0; printf("%d",ans); }