Tag: problem: (B) The Festive Evening Solution In C/C++

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

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

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!