제출 #476339

#제출 시각아이디문제언어결과실행 시간메모리
476339starplatNivelle (COCI20_nivelle)C++14
0 / 110
5 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; for (int i=1;i<=n;i++){ while (j<=n){ if (j==n) break; 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; } //cout<<i<<" "<<j<<" "<<ct/(double)(j-i+1)<<" "<<best<<"\n"; if (best>ct/(double)(j-i+1)){ best=ct/(double)(j-i+1); l=i,r=j; } if (best<ct/(double)(j-i+1)) { break; } } if (best>ct/(double)(j-i+1)){ best=ct/(double)(j-i+1); l=i,r=j; } ac[s[i]-'a']--; if (ac[s[i]-'a']==0)--ct; } 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...