Submission #499294

#TimeUsernameProblemLanguageResultExecution timeMemory
499294inksamuraiNivelle (COCI20_nivelle)C++17
24 / 110
1087 ms716 KiB
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define sz(a) (int)a.size() #define all(a) a.begin(),a.end() #define rep(i,n) for(int i=0;i<n;i++) #define crep(i,x,n) for(int i=x;i<n;i++) #define drep(i,n) for(int i=n-1;i>=0;i--) #define vec(...) vector<__VA_ARGS__> #define _3qplfh5 ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef long double ld; using pii=pair<int,int>; using vi=vector<int>; using vll=vector<long long>; int main(){ _3qplfh5; int n; cin>>n; vi a(n); rep(i,n){ char ch; cin>>ch; a[i]=ch-'a'; } ld ans=1e9; pii p={-1,-1}; rep(i,n){ set<char> ch; crep(j,i,n){ ch.insert(a[j]); ld x=sz(ch),y=j-i+1; if(x/y<ans){ ans=x/y; p={i,j}; } } } cout<<p.fi+1<<" "<<p.se+1<<"\n"; // 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...