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

#TimeUsernameProblemLanguageResultExecution timeMemory
1017461vjudge1Nivelle (COCI20_nivelle)C++17
110 / 110
55 ms12508 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int const N=2e5+5; int const mod=1e9+7; int nxt[N][30]; int main(){ int n; cin>>n; string s; cin>>s; for(int i=0;i<30;i++) nxt[n][i]=n; for(int i=n-1;i>=0;i--){ for(int j=0;j<30;j++) nxt[i][j]=nxt[i+1][j]; nxt[i][s[i]-'a']=i; } int l=0,r=0; int len=1,d=1; for(int i=0;i<n;i++){ sort(nxt[i],nxt[i]+26); for(int c=0;c<=26;c++){ int ln=nxt[i][c]-i; if(c*len<d*ln){ // cout<<i<<' '<<c<<endl; l=i; r=nxt[i][c]-1; d=c; len=ln; } } } cout<<l+1<<' '<<r+1<<endl; 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...