Submission #844497

#TimeUsernameProblemLanguageResultExecution timeMemory
844497vjudge1Nivelle (COCI20_nivelle)C++17
24 / 110
1048 ms600 KiB
#include <bits/stdc++.h> #define fast cin.tie(0)->sync_with_stdio(0); #define int long long #define inf ((int)1e18) #define N 200005 using namespace std; int32_t main(){ fast int n; cin>>n; string s; cin>>s; double mn = inf; int l, r; for(int i = 0; i < n; i++) { set <char> st; double tmn = inf; int mnr; for(int j = i; j < n; j++) { st.insert(s[j]); double val = (double) st.size() / (j - i + 1); if(val < tmn) { mnr = j; tmn = val; } } if(tmn < mn) { l = i, r = mnr; mn = tmn; } } cout<<l + 1<<" "<<r + 1; }

Compilation message (stderr)

nivelle.cpp: In function 'int32_t main()':
nivelle.cpp:33:24: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |  cout<<l + 1<<" "<<r + 1;
      |                        ^
nivelle.cpp:33:12: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |  cout<<l + 1<<" "<<r + 1;
      |            ^
#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...