## Codeforces Round #426 (Div. 2), problem: (E) Ever-Hungry Krakozyabra Solution In C/C++

By |2017-08-04T12:30:50+06:00August 4th, 2017|Categories: C/C++, Programming||

#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 19 char strL[N+1], strR[N+1]; int l, r, i, n, j, sum, k; int bufL[N] = {0}, bufR[N] = {0}; int *L, *R; int num[10] = {0}, has[10] = {0}; int ok(void) { if(n == 0) { [...]

## Codeforces Round #426 (Div. 2), problem: (D) The Bakery Solution In C/C++

By |2017-08-04T12:29:10+06:00August 4th, 2017|Categories: C/C++, Programming||

#include <bits/stdc++.h> #define For(i,a,b) for(long long i=a;i<=b;i++) #define Ford(i,a,b) for(int i=a;i>=b;i--) #define dream_hyojooslh using namespace std; const int N=200000+1067,T=67; int f[N][T],it[T][N],lz[T][N],trai[N],phai[N],a[N]; void build(int x,int l,int r) { trai[x]=l; phai[x]=r; if (l==r) return; int mid =(l+r)/2; build(x*2,l,mid); build(x*2+1,mid+1,r); } void down(int t,int x) { lz[t][x*2]+=lz[t][x]; [...]

## Codeforces Round #426 (Div. 2), problem: (C) The Meaningless Game Solution In C/C++

By |2017-08-04T12:27:39+06:00August 4th, 2017|Categories: C/C++, Programming||

#include <bits/stdc++.h> using namespace std; int main() { ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; long long int a,b,g; cin >> n; while (n--) { cin >> a >> b; g = round(pow(a * b, 1.0 / 3)); if (a % g == 0 [...]

## Codeforces Round #426 (Div. 2), problem: (B) The Festive Evening Solution In C/C++

By |2017-08-04T12:26:27+06:00August 4th, 2017|Categories: C/C++, Programming||

#include<cstdio> bool pd[26]; char s[1000007]; int n,k,size,last[26]; int main(){ scanf("%d%d%s",&n,&k,&s); for (int i=0;i<n;++i) last[s[i]-'A']=i; for (int i=0;i<n;++i){ if (!pd[s[i]-'A']) pd[s[i]-'A']=true,++size; if (size>k){ printf("YES"); return 0; } if (i==last[s[i]-'A']) --size; } printf("NO"); }

## Codeforces Round #426 (Div. 2), problem: (A) The Useless Toy Solution In C/C++

By |2017-08-04T12:24:29+06:00August 4th, 2017|Categories: C/C++, Programming||

#include<bits/stdc++.h> using namespace std; int t[1000]; int main(){ char a,b; int n; scanf(" %c %c",&a,&b); scanf("%d",&n); n%=4; t['^']=0,t['>']=1,t['v']=2,t['<']=3; int c=(t[a]-t[b]+4)%4; if(n==0||n==2)puts("undefined"); else puts(n!=c?"cw":"ccw"); }