## Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (F) Best Edge Weight Solution in C/C++

By |2017-07-24T18:10:46+06:00July 24th, 2017|Categories: C/C++, Programming||

#include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <cstdlib> #include <cstdio> #include <map> #include <ctime> #include <vector> #define INF 2000000000 #define N 200010 using namespace std; bool in_MST[N]; int jump[N][18] , maxl[N][18] , fa[N]; int ans[N] , fir[N] , tot , rep[N] , [...]

## Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (D) High Load Solution In C/C++

By |2017-07-24T18:04:33+06:00July 24th, 2017|Categories: C/C++, Programming||

#include <cstdio> int main(){ int n, k; scanf("%d%d", &n, &k); int l = (n - 2) / k + 1; printf("%d\n", 2 * l - ((n - 1) % k == 1)); for(int i = 2; i <= n; i++) printf("%d %d\n", i, i [...]

## Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (C) String Reconstruction Solution In C/C++

By |2017-07-24T18:02:55+06:00July 24th, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; const int maxn=2e6+5; int main() { char a[maxn]={}; int n,k,i; cin>>n; while(n--){ string x; cin>>x>>k; int t,len=x.size(),tt=-len; while(k--){ scanf("%d",&t); for(i=max(0,tt+len-t);i<len;i++) a[i+t]=x[i]; tt=t; } } for(i=maxn-1;!a[i];) i--; for(int j=1;j<=i;j++) putchar(a[j]?a[j]:'a'); return 0; }

## Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals), problem: (A) Restaurant Tables Solution in C/C++

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

#include <iostream> using namespace std; int main() { int n,a,b,bg=0,d=0,x; cin>>n>>a>>b; while(n--){ cin>>x; if(x==1) {if(a)a--; else if(b)b--,bg++; else if(bg)bg--; else d++; } else {if(b)b--;else d+=2; } } cout<<d; }