Educational Codeforces Round 32
来源:互联网 发布:大数据的特点 编辑:程序博客网 时间:2024/05/22 00:30
很好的 二分 宛如智障的我 唉
#include<bits/stdc++.h>using namespace std;#define maxn 100000+10char a[maxn];int len;int check(int x){ int c[26+10]; memset(c,0,sizeof(c)); for(int j=0;j<x;j++){ c[a[j]-'a']++; } int sum=0; for(int j=0;j<26;j++){ if(c[j]) sum++; else c[j]=-1; } for(int j=x;j<len;j++){ if(c[a[j]-'a']>0){ c[a[j]-'a']++; } c[a[j-x]-'a']--; if(c[a[j-x]-'a']==0){ sum--; } if(sum==0) return 0; } return 1;}int main(){ cin>>a; len=strlen(a); int l=0,r=len; while(l<r){ int mid=(l+r)/2; if(check(mid)){ r=mid; } else { l=mid+1; } } cout<<l<<endl; return 0;}
阅读全文
0 0
- Educational Codeforces Round 32
- Educational Codeforces Round 32
- Educational Codeforces Round 32[题解]
- cf Educational Codeforces Round 32
- Educational Codeforces Round 32 题解
- Educational Codeforces Round 32 E 折半枚举
- Educational Codeforces Round 32 A B C
- Educational Codeforces Round 32 G. Xor-MST
- Educational Codeforces Round 32 F. Connecting Vertices
- Educational Codeforces Round 1
- Educational Codeforces Round 2
- Educational Codeforces Round 2
- Educational Codeforces Round 2
- Educational Codeforces Round 3
- Codeforces Educational Round 3
- Codeforces Educational Round 5
- Codeforces Educational round 5
- Educational Codeforces Round 5
- 5.5
- Tensorflow将模型导出为一个文件及接口设置
- SAS学习笔记(二)
- Hibernate持久化对象修改id重新保存的办法——Hibernate学习记录二
- 计算一个数的各位之和
- Educational Codeforces Round 32
- 最大递增子序列
- django 样式表不生效 也没有报错 但就是请求不到css文件
- Codeforces Round #444 (Div. 2)-ABC
- HTTP协议是无状态的如何理解 Connection: Keep-Alive
- 字符串操作
- 虚拟机不能访问外网
- Windows 2d游戏开发
- Install Dlib and OpenCV 3 on MacOS