제출 #476356

#제출 시각아이디문제언어결과실행 시간메모리
476356starplatNivelle (COCI20_nivelle)C++14
0 / 110
4 ms460 KiB
#include <bits/stdc++.h> using namespace std; string s; int l,r,n,j,ct,ac[150],ok; double best; int main() { cin>>n>>s; s='#'+s; ok=1; for (int i=1;i<=n;i++){ while (j<n){ j++; if (ac[s[j]-'a']==0) ct++; ac[s[j]-'a']++; if (l==0){ best=ct/(double)(j-i+1); l=i,r=j; } else if (best>=ct/(double)(j-i+1)){ best=ct/(double)(j-i+1); l=i,r=j; } else { ac[s[j]-'a']--; if (ac[s[j]-'a']==0) --ct; --j; break; } } while (best+1e-9>=ct/(double)(j-i+1)&&i<=j) { best=ct/(double)(j-i+1); l=i,r=j; ac[s[i]-'a']--; if (ac[s[i]-'a']==0) ct--; i++; } } cout<<l<<" "<<r<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...