| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 442953 | Dipto_Debdip | Nivelle (COCI20_nivelle) | C++14 | 634 ms | 524292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
bool cmp(pair<ll, ll> a, pair<ll, ll> b) {
return a.second - a.first > b.second - b.first;
}
int main(int argc, char const *argv[]) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n;
string s;
cin >> n;
cin >> s;
set<char> st;
vector<pair<pair<ll, ll>, pair<ll, ll>>> v;
//ll l2 = 10000, d2 = 10000;
for (ll i = 0; i < n; i++) {
map<char, ll> mp;
ll l1 = 0, l2 = 0;
st.insert(s[i]);
for (ll j = i; j < n; j++) {
if (!mp[s[j]]) {
l1++;
mp[s[j]]++;
}
l2++;
v.push_back({{i, j}, {l1, l2}});
}
}
ll l, r;
ll c1 = 10000, c2 = 10000;
for (auto i : v) {
ll h1 = i.second.first;
ll h2 = i.first.second - i.first.first + 1;
if (c1 * h2 > h1 * c2) {
l = i.first.first + 1;
r = i.first.second + 1;
c1 = h1;
c2 = h2;
}
}
if (st.size() == n) cout << "1 1" << endl;
else cout << l << " " << r << endl;
return 0;
}
Compilation message (stderr)
| # | 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... | ||||
