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

#TimeUsernameProblemLanguageResultExecution timeMemory
844719MKutayBozkurtNivelle (COCI20_nivelle)C++17
110 / 110
25 ms664 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; double d = 1e9; pair<int, int> ans; for (int i = 1; i <= 26; i++) { vector<int> m(26); int cnt = 0, l = 0; for (int r = 0; r < n; r++) { if (m[s[r] - 'a'] == 0) cnt++; m[s[r] - 'a']++; while (cnt > i) { m[s[l] - 'a']--; if (m[s[l] - 'a'] == 0) cnt--; l++; } if ((double) i / (r - l + 1) < d) { d = (double) i / (r - l + 1); ans = make_pair(l, r); } } } 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...