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

#TimeUsernameProblemLanguageResultExecution timeMemory
442895nadidaditNivelle (COCI20_nivelle)C++17
24 / 110
1088 ms20940 KiB
#include<bits/stdc++.h> #define ll long long int #define ld long double using namespace std; int main() { ll n; cin>>n; string a; cin>>a; ll l,r; ld mi=129198.0000000; ll cnt[n+1][26]; for(ll i=0;i<26;i++) { cnt[0][i]=0; } for(int i=1;i<=n;i++) { char x=a[i-1]; ll y=x-'a'; cnt[i][y]=cnt[i-1][y]+1; for(int j=0;j<26;j++) { if(j!=y) { cnt[i][j]=cnt[i-1][j]; } } } for(ll i=0;i<n;i++) { for(ll j=0;j<n;j++) { if(i<=j) { ll cnt1=0; for(ll k=0;k<26;k++) { ll cnt2=cnt[j+1][k]-cnt[i][k]; if(cnt2>0) { char z=k+'a'; // cout<<"char= "<<z<<endl; cnt1++; } } ld ans=(ld)cnt1/(ld)(j-i+1); // cout<<"i= "<<i<<" "<<" j= "<<j<<" cnt1= "<<cnt1<<" len= "<<j-i+1<<" ans= "<<ans<<" mi= "<<mi<<endl; if(mi-ans>0.0000000000) { // cout<<"here"<<endl; mi=ans; l=i; r=j; } } } } cout<<l+1<<" "<<r+1<<endl; return 0; }

Compilation message (stderr)

nivelle.cpp: In function 'int main()':
nivelle.cpp:43:12: warning: unused variable 'z' [-Wunused-variable]
   43 |       char z=k+'a';
      |            ^
nivelle.cpp:60:10: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
   60 |  cout<<l+1<<" "<<r+1<<endl;
      |          ^
nivelle.cpp:60:20: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   60 |  cout<<l+1<<" "<<r+1<<endl;
      |                    ^
#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...