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

#TimeUsernameProblemLanguageResultExecution timeMemory
1099958PetrixNivelle (COCI20_nivelle)C++17
110 / 110
25 ms756 KiB
#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)

nivelle.cpp: In function 'int main()':
nivelle.cpp:8:34: warning: unused variable 'k' [-Wunused-variable]
    8 |     int n,i,rst=0,rdr=0,dr,j,dif,k;
      |                                  ^
#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...