Submission #844588

#TimeUsernameProblemLanguageResultExecution timeMemory
844588vjudge1Nivelle (COCI20_nivelle)C++14
24 / 110
1059 ms600 KiB
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein #include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native") #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define ff first #define ss second #define pb push_back #define rev reverse #define all(x) x.begin(),x.end() #define acc accumulate #define sz size() #define MOD 1000000007 #define rall(x) x.rbegin(),x.rend() #define rep(i, x, n) for(int i = x; i < n; i++) using namespace std; const int N = 1e6 + 5; inline void solve(){ double n; string s; cin >> n >> s; double ok[26], cnt = 0, l, r; fill(ok, ok+26, 0); double mn = n +5; rep(i, 0, n){ rep(j, i, n){ if(!ok[s[j] - 'a']){ ok[s[j] - 'a'] = 1; cnt++; } double ans = cnt / (j-i+1); if(mn > ans){ mn = ans; l = i, r = j; } } cnt = 0; fill(ok, ok+26, 0); } cout << l+1 << " " << r+1 << endl; } int main(){ fast_io int t; t = 1; while(t--) solve(); }

Compilation message (stderr)

nivelle.cpp: In function 'void solve()':
nivelle.cpp:41:29: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |     cout << l+1 << " " << r+1 << endl;
      |                             ^
nivelle.cpp:41:15: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |     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...