834_b_The Festive Evening
来源:互联网 发布:叮叮软件 编辑:程序博客网 时间:2024/05/17 21:52
http://codeforces.com/problemset/problem/834/B
#include<cstring>#include<iostream>using namespace std;int a[1000005];//每个字母对应的位置int b[100];//代表字母第几次出现int main(){ memset(b,0,sizeof(b)); memset(a,0,sizeof(a)); int n,k; string s; cin>>n>>k>>s; for(int i=0; i<n; i++) { if(b[s[i]-'A']==0) a[i]++; b[s[i]-'A']++; } for(int i=0; i<n; i++) { b[s[i]-'A']--; if(b[s[i]-'A']==0) a[i+1]--;//自己的门守完后再去别的门守。 } int sum=0; int maxx=0; for(int i=0; i<n; i++) { sum+=a[i]; maxx=max(maxx,sum); } if(maxx>k) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0;}
阅读全文
0 0
- 834_b_The Festive Evening
- CodeFroces 834B. The Festive Evening(暴力)
- Codeforces 834B-The Festive Evening
- Codeforces Round 834B-The Festive Evening
- Codeforces 834 B The Festive Evening
- CodeForces 834B The Festive Evening
- CF 834B-The Festive Evening
- codefores 834B The Festive Evening
- CF 834B The Festive Evening
- Codeforces834B The Festive Evening
- CF834B-The Festive Evening
- The Festive Evening map
- The Festive Evening
- The Festive Evening
- The Festive Evening (Codeforces
- CodeForces 834 B.The Festive Evening(水~)
- cf The Festive Evening(水)
- The Festive Evening(思维题)
- DOM扩展
- Unicode 与 Unicode Transformation Format(UTF-8 / UTF-16 / UTF-32)
- QT Creator 快速入门教程 读书笔记
- 效验连续区间
- 微信小程序
- 834_b_The Festive Evening
- elasticsearch的object类型和动态映射
- 用户体验 | 寻找成套的 App SDK 服务
- ubuntu16.04下安装TensorFlow(GPU加速)----详细图文教程
- 浅拷贝&深拷贝的再次理解
- PHP 表单处理
- 华为腾讯互掐背后物联网数据的重要性
- eclipse上配置tomcat
- 微信小程序组件