| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1336195 | kawhiet | Nivelle (COCI20_nivelle) | C++20 | 20 ms | 652 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
string a;
cin >> n >> a;
vector<int> f(26);
int cnt = 0;
auto add = [&](int i) {
int j = a[i] - 'a';
if (f[j]++ == 0) {
cnt++;
}
};
auto rem = [&](int i) {
int j = a[i] - 'a';
if (--f[j] == 0) {
cnt--;
}
};
double mn = 1e9;
int tl = 0, tr = 0;
for (int k = 1; k <= 26; k++) {
cnt = 0;
ranges::fill(f, 0);
for (int l = 0, r = 0; r < n; r++) {
add(r);
while (cnt > k) {
rem(l++);
}
int len = r - l + 1;
if (cnt <= k) {
if (double(k) / len < mn) {
mn = double(k) / len;
tl = l;
tr = r;
}
}
}
}
cout << tl + 1 << ' ' << tr + 1 << '\n';
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
