Codeforces Round #444 (Div. 2), problem: (F) Row of Models Solution In C/C++

By |2017-11-07T20:11:01+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include<bits/stdc++.h> #define maxn 1000050 using namespace std; int a[maxn],b[maxn],c[maxn],n,k,m,t; int main() { scanf("%d%d",&n,&k); for (int i=0;i<n;i++) scanf("%d",&a[i]); a[n]=0; memset(c,-1,sizeof(c)); m=0;b[m]=0;c[0]=0;t=0; for (int i=1;i<=n;i++) if (a[i]<a[b[m]]) b[++m]=i,c[i]=m; for (int i=1;i<=m;i++) if (b[i]-b[i-1]>2*k) {puts("NO");return 0;} else if (b[i]-b[i-1]>k) { if (t) {puts("NO");return 0;} else t=i; } [...]

Codeforces Round #444 (Div. 2), problem: (E) Little Brother Solution In C/C++

By |2017-11-07T20:08:13+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> #include<cstdlib> #define eps 1e-7 using namespace std; double x[100010],y[100010],r[100010],L; struct node{double l,r;}a[100010]; struct P{double x,y;}A,B,M,s,O,p[100010]; int n; inline double dis(P a,P b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));} inline P operator-(P a,P b){return (P){a.x-b.x,a.y-b.y};} inline double operator*(P a,P b){return a.x*b.y-a.y*b.x;} inline bool cmp(node [...]

Codeforces Round #444 (Div. 2), problem: (D) Ratings and Reality Shows Solution In C/C++

By |2017-11-07T20:05:57+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , |

#include <cstdio> #include <algorithm> using namespace std; long long n,a,b,c,d,st,len,t[300010]; int q[300010]; int main() { scanf("%lld%lld%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d,&st,&len); for (int i=1;i<=n;i++) scanf("%lld%d",&t[i],&q[i]); t[0]=-1; int now=1; long long change_rating=0,Min=0,rating=st; for (int i=1;i<=n;i++) { while (now<=n&&t[now]-t[i]<len) { change_rating+=(q[now]?c:-d); Min=min(Min,change_rating); now++; } if (Min+rating>=0) { printf("%lld\n",t[i-1]+1); return 0; } [...]

Codeforces Round #444 (Div. 2), problem: (C) Solution for Cube Solution In C/C++

By |2017-11-07T20:03:01+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , |

#include <bits/stdc++.h> using namespace std; const int R[6][8] = { {12, 13, 4, 5, 16, 17, 20, 21}, {14, 15, 6, 7, 18, 19, 22, 23}, { 0, 2, 4, 6, 8, 10, 23, 21}, { 1, 3, 5, 7, 9, 11, 22, 20}, [...]

Codeforces Round #444 (Div. 2), problem: (B) Cubes for Masha Solution In C/C++

By |2017-11-07T20:00:13+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include<stdio.h> int main() { int n,i,j,k,m,A[10][10],B[1000]; scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=6;j++){ scanf("%d",&A[i][j]);} } for(i=1;i<=100;i++){ B[i]=0;} for(i=1;i<=n;i++){ for(j=1;j<=6;j++){ B[A[i][j]]=1; for(k=1;k<=n;k++){ for(m=1;m<=6;m++){ if (k!=i){ B[A[i][j]*10+A[k][m]]=1; } } } } } i=1; while(B[i]){ i++;} printf("%d",i-1); return 0; }

Codeforces Round #444 (Div. 2), problem: (A) Div. 64 Solution In C/C++

By |2017-11-07T19:58:04+00:00November 7th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<stdio.h> char s[107]; int main() { scanf(" %s",s); int x=0,y=0,z=0; while(s[x]=='0') x++; while(s[z]!=0) z++; for(int i=x+1;i<z;i++) if(s[i]=='0') y++; if(y>=6) printf("yes"); else printf("no"); return 0; }