# Rated Archive

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (C) Jury Marks Solution In C/C++

#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>k>>n; int t; int arr; set<int>c; for(int i=0;i<k;i++){ cin>>t; arr= arr+t; } for(int i=0;i<n;i++){ cin>>t; set<int>mmp; for(int j=0;j<k;j++){ int x = t-arr; if(!i||(c.find(x) != c.end())){ mmp.insert(x); } …

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (B) Keyboard Layouts Solution In C/C++

#include <bits/stdc++.h> using namespace std; string s1, s2, t; int main() { cin >> s1 >> s2 >> t; for(char c : t) putchar(c < 58 ? c : s2 – (c < 91 ? …

## Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals), problem: (A) Unimodal Array Solution In C/C++

#include<cstdio> using namespace std; int n,i,la,nw,fl,tp; int main(){ for(scanf(“%d%d”,&n,&la);++i<n;la=nw,fl=tp) if(scanf(“%d”,&nw),fl>(tp=(nw>la?0:(nw<la?2:1))))return puts(“NO”); return puts(“YES”); }

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

#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 …

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

#include <cstdio> #include <iostream> #include <algorithm> #define N 100010 using namespace std; typedef long long ll; int n,m; int a; struct segt{ int l,r,cd; int f,lazy; ll sum; ll val(){ ll ret=0; for(int i=0;i<10;i++) ret+=sum*i; …

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

#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,b; int main() { int n,i,x,y; cin>>n; for(i=1;i<=n;i=i+1) cin>>a; for(i=1;i<=n;i=i+1) { x=(i-1)-(n-i); if(x<0) x=-x; b=max(b,a); } for(i=1;i<n;i=i+1) { x=(i-1)-(n-i-1); if(x<0) …

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

#include<bits/stdc++.h> #define MAXN 300100 using namespace std; struct node{int y,next;}e; int n,m,len,Link,p,hash,col,vis,used; 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.next=Link;Link=len;e.y=y;} void dfs(int …

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

#include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define MN 300000 char a,b,c; 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>a)c=b; else c=b; else if(a<b)c=a; else c=a; puts(c); …

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

#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++

#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); }