Submission #844443

#TimeUsernameProblemLanguageResultExecution timeMemory
844443vjudge1Nivelle (COCI20_nivelle)C++17
24 / 110
1046 ms856 KiB
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG #include "/Users/kutay/CP/templates/debug.h" #else #define debug(...) void(38) #endif #define int long long int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; string s; cin >> s; vector<int> m(26); pair<int, int> ans = make_pair(-1, -1); double d = 1e9; for (int i = 0; i < n; i++) { m = vector<int>(26); for (int j = i; j < n; j++) { m[s[j] - 'a'] = 1; int sum = accumulate(m.begin(), m.end(), 0); debug(sum, j - i + 1, d); if ((double) sum / (j - i + 1) < d) { d = (double) sum / (j - i + 1); ans = make_pair(i, j); } } } cout << ans.first + 1 << " " << ans.second + 1 << '\n'; }
#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...