Submission #844486

#TimeUsernameProblemLanguageResultExecution timeMemory
844486vjudge1Nivelle (COCI20_nivelle)C++17
0 / 110
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 2e5 + 5, MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; string str; cin >> n >> str; str = "#" + str; int cnt = 1, left = 1, right = n; long double ans = (long double)2 / (long double)n; for(int i = 2; i <= n; i++) { if(str[i] == str[i - 1]) { cnt++; } else { if((long double)1 / (long double)cnt < ans) { left = i - cnt; right = i - 1; ans = (long double)1 / (long double)cnt; } } } cout << left << " " << right << '\n'; }
#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...