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

#TimeUsernameProblemLanguageResultExecution timeMemory
256660MrRobot_28Nivelle (COCI20_nivelle)C++17
110 / 110
114 ms768 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; string s; cin >> s; int cnt = n; int l = 0, r = n - 1; vector <int> end(26, -1); for(int i = 0; i < n; i++) { vector <int> mass; end[s[i] - 'a'] = i; for(int j = 0; j < 26; j++){ if(end[j] != -1) { mass.push_back(end[j]); } } sort(mass.begin(), mass.end()); int c = 0; for(int j = mass.size() - 1; j >= 0; j--) { if(mass[j] < i) { if(cnt * (i - mass[j]) > c * (r - l + 1)) { l = mass[j] + 1; r = i; cnt = c; } } c++; } if(cnt * (i + 1) > c * (r - l + 1)) { l = 0; r = i; cnt = c; } } cout << l + 1 << " " << r + 1; 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...