# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
844497 | vjudge1 | Nivelle (COCI20_nivelle) | C++17 | 1048 ms | 600 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>
#define fast cin.tie(0)->sync_with_stdio(0);
#define int long long
#define inf ((int)1e18)
#define N 200005
using namespace std;
int32_t main(){
fast
int n;
cin>>n;
string s;
cin>>s;
double mn = inf;
int l, r;
for(int i = 0; i < n; i++) {
set <char> st;
double tmn = inf;
int mnr;
for(int j = i; j < n; j++) {
st.insert(s[j]);
double val = (double) st.size() / (j - i + 1);
if(val < tmn) {
mnr = j;
tmn = val;
}
}
if(tmn < mn) {
l = i, r = mnr;
mn = tmn;
}
}
cout<<l + 1<<" "<<r + 1;
}
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... |