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

#TimeUsernameProblemLanguageResultExecution timeMemory
464824TheScrasseNivelle (COCI20_nivelle)C++17
110 / 110
44 ms620 KiB
#include <bits/stdc++.h> using namespace std; #define nl "\n" #define nf endl #define ll long long #define pb push_back #define _ << ' ' << #define INF (ll)1e18 #define mod 998244353 #define maxn 100010 ll i, i1, j, k, k1, t, n, m, res, flag[10], a, b; ll l, r, f[36]; array<ll, 3> rs; string s; array<ll, 3> mxx(array<ll, 3> a, array<ll, 3> b) { if (a[0] * (b[2] - b[1] + 1) < b[0] * (a[2] - a[1] + 1)) return a; return b; } int main() { ios::sync_with_stdio(0); cin.tie(0); #if !ONLINE_JUDGE && !EVAL ifstream cin("input.txt"); ofstream cout("output.txt"); #endif cin >> n >> s; s = '#' + s; rs = {1, 0, 0}; for (i = 1; i <= 26; i++) { for (j = 0; j <= 25; j++) f[j] = 0; l = 1; r = 0; k = 0; while (l <= n) { if (r == n || k > i) { m = (ll)s[l] - 'a'; f[m]--; l++; if (f[m] == 0) k--; } else { r++; m = (ll)s[r] - 'a'; f[m]++; if (f[m] == 1) k++; } if (k <= i) rs = mxx(rs, {i, l, r}); } } cout << rs[1] _ rs[2] << nl; return 0; }
#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...