Codeforces Round #425 (Div. 2), problem: (E) Vasya and Shifts Solution In C/C++

By |2017-07-25T01:21:36+00:00July 25th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<bits/stdc++.h> #define oo 0x3f3f3f3f #define cl(x) memset(x, 0, sizeof(x)) #define mp make_pair #define fr first #define sc second #define pii pair<int, int> #define pb push_back #define mo 1000000007 #define maxn 510 typedef long long ll; using namespace std; void gn(int &x) { x = [...]

Codeforces Round #425 (Div. 2), problem: (D) Misha, Grisha and Underground Solution In C/C++

By |2017-07-25T01:18:21+00:00July 25th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include<cstdio> #include<iostream> using namespace std; struct Edge{ int to,next; }e[202020]; int head[101010],cnt=0; void add(int u,int v) { cnt++; e[cnt].to=v; e[cnt].next=head[u]; head[u]=cnt; } int anc[20][101010]; int dep[101010]; void dfs(int x,int fa) { for(int i=head[x];i!=0;i=e[i].next) { int to=e[i].to; if(to!=fa) { dep[to]=dep[x]+1; anc[0][to]=x; dfs(to,x); } } } [...]

Codeforces Round #425 (Div. 2), problem: (C) Strange Radiation Solution In C/C++

By |2017-07-25T01:16:19+00:00July 25th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using D = double; using uint = unsigned int; template<typename T> using pair2 = pair<T, T>; #ifdef WIN32 #define LLD "%I64d" #else #define LLD "%lld" #endif #define pb push_back [...]

Codeforces Round #425 (Div. 2), problem: (B) Petya and Exam Solution In C/C++

By |2017-07-25T01:14:34+00:00July 25th, 2017|Categories: C/C++, Programming, Uncategorized|Tags: , , , , , , , |

#include<iostream> #include<cstdio> #include<cstring> using namespace std; string s,t; int q; string str; int w; bool g[26]; int main() { cin>>s; for(int i=0;i<s.size();i++) { g[s[i]-'a']=true; } cin>>t; int lt=t.size(); int s=0; w=-1; for(int i=0;i<lt;i++) { if(t[i]=='*')w=i;else s++; } scanf("%d",&q); while(q--) { cin>>str; int l=str.size(); if(l<s [...]

Codeforces Round #425 (Div. 2), problem: (A) Sasha and Sticks Solution In C/C++

By |2017-07-25T01:12:24+00:00July 25th, 2017|Categories: Uncategorized|Tags: , , , , , , , |

#include <cstdio> int main() { long long n, k; scanf("%I64d%I64d", &n, &k); puts((n / k) & 1 ? "YES" : "NO"); return 0; }