(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.

Submission #823968

#TimeUsernameProblemLanguageResultExecution timeMemory
823968elotelo966Nivelle (COCI20_nivelle)C++17
0 / 110
3 ms692 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define OYY 1000000005 #define mod 1000000007 #define mid (start+end)/2 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); map<char,int> mp; int vis[100005]; vector <pair<int,int>> v(27); int32_t main(){ faster int n,maxi=0;cin>>n; string s;cin>>s; for(int i=0;i<n;i++){ mp[s[i]]++; maxi=max(maxi,mp[s[i]]); int deg=s[i]-'a'; if(v[deg].first==0)v[deg].first=i+1; else v[deg].first=min(v[deg].first,i+1); v[deg].second=max(v[deg].second,i+1); } int l=OYY,r=0; map<char,int> ::iterator it=mp.begin(); while(it!=mp.end()){ if(it->second==maxi){ int deg=it->first-'a'; l=min(l,v[deg].first); r=max(r,v[deg].second); } it++; } cout<<l<<" "<<r<<'\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...