# based on VK Cup 2017 Round 2)

/Tag: based on VK Cup 2017 Round 2)

## Codeforces Round #409 (rated, Div. 1, based on VK Cup 2017 Round 2), problem: (E) Verifying Kingdom Solution In C/C++

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

#include<cstdio> #include<cstring> #include<algorithm> #include<cctype> #include<ctime> #include<cstdlib> #include<string> #include<queue> #include<cmath> #include<set> #include<map> #include<bitset> #include<vector> #define rep(x,a,b) for (int x=int(a);x<=(int)(b);x++) #define drp(x,a,b) for (int x=int(a);x>=(int)(b);x--) #define cross(x,a) for (int x=hd[a];~x;x=nx[x]) #define ll long long #define inf (1<<29) #define pii pair<int,int> #define pdd pair<double,double> #define mk(a,b) make_pair(a,b) [...]

## Codeforces Round #409 (rated, Div. 1, based on VK Cup 2017 Round 2), problem: (D) Varying Kibibits Solution In C/C++

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

#include <bits/stdc++.h> #define MAXN (1000000) #define MAXM (6) #define mod (1000000007) #define ll long long int n; int a[MAXN], b[MAXN], c[MAXN], g[MAXN], pow10[MAXM + 2]; void FWT(int *a, int length, int len){ for(int i = 1; i <= len; ++ i){ for(int j = [...]

## Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (E) Vulnerable Kerbals Solution in JAVA

By |2017-07-24T01:31:20+06:00July 24th, 2017|Categories: Java, Programming||

import java.util.ArrayList; import java.util.Scanner; /* 4 10 2 4 6 8 4 10 2 9 1 0 */ public class e { static ArrayList<Integer>[] gcdLists; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(),m=in.nextInt(); boolean[] forbid = new [...]

## Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (D) Volatile Kite Solution In C/C++

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

#include<cstdio> #include<cstdlib> #include<cmath> #include<algorithm> #include<cstring> using namespace std; #define maxn 1005 int x[maxn],y[maxn]; int n; long long area(int i) { int j=(i-1+n)%n,k=(i+1)%n; long long x1=x[i]-x[j],y1=y[i]-y[j], x2=x[i]-x[k],y2=y[i]-y[k]; return abs(x1*y2-x2*y1); } double length(int i) { int j=(i-1+n)%n,k=(i+1)%n; long long dx=x[j]-x[k],dy=y[j]-y[k]; return sqrt(dx*dx+dy*dy); } int main() { [...]

## Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (C) Voltage Keepsake Solution In C/C++

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

#include <bits/stdc++.h> using namespace std; struct Time { int i; double v; }; const int MAXN = 1e5; int a[MAXN], b[MAXN]; Time t[MAXN+1]; int main() { int n, p; cin >> n >> p; for (int i = 0; i < n; ++i) { [...]

## Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (B) Valued Keys Solution In C/C++

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

#include<bits/stdc++.h> using namespace std; int main() { string a,b; cin>>a>>b; int l=a.length(); for(int i=0;i<l;i++) { if(a[i]<b[i]) { cout<<"-1"; return 0; } } cout<<b; }

## Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2), problem: (A) Vicious Keyboard Solution In C/C++

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

#include <stdio.h> int ans,l,i; int main() { char ch[110]; scanf("%s",ch); for( ; ch[i+1]; i++) { l++; if(ch[i]=='V' && ch[i+1]=='K') ans++,ch[i]='#',ch[i+1]='#',i++; } l++; for(i=0; ch[i+1]; i++) { if((ch[i]=='V' && ch[i+1]=='V') || (ch[i]=='K'&&ch[i+1]=='K')) { ans++; break; } } printf("%d",ans); }