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

By |2017-11-08T09:27:59+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include<cstdio> #include<cstring> #include<algorithm> #include<set> using namespace std; int n,k; struct node { int maxx[15],minn[15],sz; node() { int x;sz = 1; for(int i = 1; i <= k ; i ++) { scanf("%d",&x); minn[i] = maxx[i] = x; } } bool operator<(const node &nd)const { [...]

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

By |2017-11-08T09:26:00+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

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

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

By |2017-11-08T09:24:01+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , |

#include <iostream> using namespace std; const int maxn = 5e5; int n, x, a = 0, b = 1023, y[3]; char c; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> c >> x; if [...]

Codeforces Round #443 (Div. 2), problem: (B) Table Tennis Solution In C/C++

By |2017-11-08T09:22:14+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , |

#include <iostream> using namespace std; int main() { long long n,k,a,m=0,ab=0; cin>>n>>k>>ab; while(--n){ cin>>a; if(m==k){break;} if(ab>a){m++;} else ab=a,m=1; } cout<<ab; }

Codeforces Round #443 (Div. 2), problem: (A) Borya’s Diagnosis Solution In C/C++

By |2017-11-08T09:19:12+00:00November 8th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<bits/stdc++.h> using namespace std; int main() { int n,i,s,d,t=0; cin>>n; for(i=0;i<n;i++) { cin>>s>>d; while(s<=t) { s=s+d; } t=s; } cout<<s<<endl; }