# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099958 | Petrix | Nivelle (COCI20_nivelle) | C++17 | 25 ms | 756 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int frv[26];
int main()
{
int n,i,rst=0,rdr=0,dr,j,dif,k;
double rasp=1e9;
string s;
cin>>n>>s;
s=" "+s;
for(i=1;i<=26;i++){
for(j=0;j<26;j++){
frv[j]=0;
}
dr=1;dif=0;
for(j=1;j<=n;j++){
while(dr<=n && dif+(frv[s[dr]-'a']==0)<=i){
if(frv[s[dr]-'a']==0){
dif++;
}
frv[s[dr]-'a']++;
dr++;
}
if(dif>=i && rasp>(double)i/(dr-j)){
rasp=(double)i/(dr-j);
rst=j;rdr=dr-1;
}
if(frv[s[j]-'a']==1){
dif--;
}
frv[s[j]-'a']--;
}
}
cout<<rst<<" "<<rdr;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |