(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #476481

#TimeUsernameProblemLanguageResultExecution timeMemory
476481starplatNivelle (COCI20_nivelle)C++14
110 / 110
45 ms640 KiB
#include <bits/stdc++.h> using namespace std; int n,ct,l,r,ac[150],j; string s; double best; int main() { cin>>n>>s; s=' '+s; for (int k=1;k<=26;k++){ memset(ac,0,sizeof(ac)); ct=0,j=0; for (int i=1;i<=n;i++){ while (j<n&&ct<=k){ j++; if (ac[s[j]-'a']==0){ if (ct+1>k) { j--; break; } ct++; } ac[s[j]-'a']++; } //if (ct==2) cout<<i<<" "<<j<<" "<<ct<<"\n"; if (l==0||best>k/(double)(j-i+1)){ best=k/(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...