(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 #1055377

#TimeUsernameProblemLanguageResultExecution timeMemory
1055377fryingducNivelle (COCI20_nivelle)C++17
110 / 110
8 ms856 KiB
/** * author: limwu * created:25.08.2022 16:17:13 **/ /* #pragma GCC optimize("Ofast,unroll-loops") */ #include "bits/stdc++.h" using namespace std; #ifdef duc_debug #include "bits/debug.h" #else #define debug(...) #endif /* #define int long long */ const int maxn = 1e5+5; int n; string s; void solve(){ cin >> n >> s; int cnt = 26, l = -1, r = -1; vector<int> a(26, -1), b(27, -1); for(int i = 0; i < n; ++i){ int ch = s[i] - 'a'; b.erase(find(b.begin(), b.end(), a[ch])); a[ch] = i; b.insert(b.begin(), i); for(int j = 1; j <= 26; ++j){ if(j * (r - l + 1) < cnt * (i - b[j])){ cnt = j; l = b[j] + 1; r = i; } } } cout << l + 1 << " " << r + 1; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int test = 1; /* cin >> test; */ for(int i = 1; i <= test; i++){ /* cout << "Case " << "#" << i << ": "; */ solve(); } 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...