Submission #844460

#TimeUsernameProblemLanguageResultExecution timeMemory
844460vjudge1Nivelle (COCI20_nivelle)C++17
7 / 110
1062 ms604 KiB
#pragma GCC optimize("unroll-loops,Ofast,O3") #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define spc << " " << #define all(x) x.begin(), x.end() #define ll long long #define int long long #define ii pair<int,int> #define vi vector<int> #define vii vector<ii> #define st first #define nd second #define inf 1000000009 #define MOD 1000000007 using namespace std; void solve(){ int n; cin >> n; string s; cin >> s; double mini= (double) 1; ii ans={1,1}; for(int i=0; i<n; i++){ for(int j=i+1; j<n; j++){ set<char> yup; for(int k=i; k<=j; k++) yup.insert(s[k]); int temp=yup.size(); double fin = ((double) temp )/ (double) (j-i+1); if(fin < mini){ mini = fin; ans={i+1, j+1}; } } } cout << ans.st spc ans.nd << endl; } signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); #ifdef Local freopen("in.txt","r",stdin); freopen("out","w",stdout); #endif ll t=1; //cin >> t; while(t--) solve(); }
#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...