HomeProgramming

Programming

Codeforces Round #443 (Div. 2), problem: (E) Tournament Solution In C/C++

#include<cstdio> #include<cstring> #include<algorithm> #include<set> using namespace std; int n,k; struct node { int maxx,minn,sz; node() { int x;sz = 1; for(int i = 1; i <= k ; i...

Codeforces Round #443 (Div. 2), problem: (D) Teams Formation Solution In C/C++

#include <stdio.h> struct node { __int64 ans,num; }s; int main() { int n,k,m; while(~scanf("%d%d%d",&n,&k,&m)) { scanf("%I64d",&s.num); s.ans=1; int len=1; for(int i=1;i<n;i++) { int x; scanf("%d",&x); if(x==s.num) { s.ans++; if(s.ans==k) { s.ans=0; len--; } } else { s.num=x; s.ans=1; len++; } } int l=0,r=len-1; __int64 sum=0; while(s.num==s.num&&r>l) { if((s.ans+s.ans)>=k)sum+=k; s.ans=(s.ans+s.ans)%k; s.ans=0; if(s.ans!=0) { break; } l++,r--; } if(l==r) { if((s.ans*m)%k==0)sum=0; else sum+=((s.ans*m)%k); } else { for(int i=l;i<=r;i++) { sum+=(s.ans*m); } } printf("%I64dn",sum); } return 0; }

Codeforces Round #443 (Div. 2), problem: (C) Short Program Solution In C/C++

#include <iostream> using namespace std; const int maxn = 5e5; int n, x, a = 0, b = 1023, y; char...

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

#include<bits/stdc++.h> #define maxn 1000050 using namespace std; int a,b,c,n,k,m,t; int main() { scanf("%d%d",&n,&k); for (int i=0;i<n;i++) ...

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

#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> #include<cstdlib> #define eps 1e-7 using namespace std; double x,y,r,L; struct node{double l,r;}a; struct P{double x,y;}A,B,M,s,O,p; 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...

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

#include <cstdio> #include <algorithm> using namespace std; long long n,a,b,c,d,st,len,t; int q; 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,&q); t=-1; int now=1; long long change_rating=0,Min=0,rating=st; for (int i=1;i<=n;i++) { while...

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

#include <bits/stdc++.h> using namespace std; const int R = { {12, 13, 4, 5, 16, 17, 20, 21}, {14, 15, 6,...

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

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

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!