(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #1094234

#제출 시각아이디문제언어결과실행 시간메모리
10942340pt1mus23Nivelle (COCI20_nivelle)C++14
110 / 110
144 ms1108 KiB
#include <bits/stdc++.h> using namespace std; #define needforspeed ios::sync_with_stdio(0);cin.tie(0); #define int long long int #define pb push_back #define ins insert #define endl '\n' #define putr(x) cout<<x<<endl;return; #define all(x) x.begin(),x.end() #define _ << " " << const int mod = 1e9 +7,sze = 2e5 +23,inf = INT_MAX, L = 31; void opt1z(){ int n; cin>>n; string s; cin>>s; pair<int,int> ans={1,1}; double ap = 1.0; for(int d=1;d<=26;d++){ // cout<<d<<" =>> "<<endl; map<char,int> cnt; int subd = 0; int l =0; int r = 0; while(r<n){ cnt[s[r]]++; if(cnt[s[r]]==1){ subd++; } while(subd>d){ cnt[s[l]]--; if(cnt[s[l]]==0){ subd--; } l++; } double bp = (subd+.0) / (r-l +1); if(bp<ap){ ap = bp; ans.first = l+1; ans.second = r+1; } r++; } } cout<<ans.first<<" "<<ans.second<<endl; } signed main() { needforspeed; int tt = 1; // cin>>tt; while(tt--){ opt1z(); } 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...