Sponsors

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

Codeforces Round #443 (Div....

#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...

Advertisement

spot_img