跳到正文

个人记录

www

#SUSPENDED#约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟

版本

  1. v1当前

#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t—) { string s; cin>>s; int ans=1e9; int l=0; unordered_map<char,int> t; for(int r=0;r<s.size();r++) { t[s[r]]++; while(t[‘1’]>=1&&t[‘2’]>=1&&t[‘3’]>=1) { ans=min(ans,r-l+1); t[s[l]]—; l++; } } cout<<(ans==1e9?0:ans)<<endl; } return 0; }

原文