(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 #791351

#TimeUsernameProblemLanguageResultExecution timeMemory
791351Saul0906Nivelle (COCI20_nivelle)C++14
110 / 110
21 ms632 KiB
#include <iostream> #define endl "\n" #define fi first #define se second using namespace std; int main() { cout.tie(0); std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int n, cont; pair<int, int> ans[27]{}; string s; cin>>n>>s; for(int k=1; k<=26; k++){ int l[26]{}; cont=0; for(int i=0, j=0; i<n; i++){ if(!l[s[i]-'a']) cont++; l[s[i]-'a']++; while(cont>k){ l[s[j]-'a']--; if(l[s[j]-'a']==0) cont--; j++; } if(i-j>=ans[k].se-ans[k].fi){ ans[k].se=i+1; ans[k].fi=j+1; } } } float acidez=n+1, X, L=0, R=0; for(int i=1; i<=26; i++){ X=i; X/=(ans[i].se-ans[i].fi+1); if(X<acidez){ acidez=X; L=ans[i].fi; R=ans[i].se; } } cout<<L<<" "<<R; return 0; }
#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...