제출 #844548

#제출 시각아이디문제언어결과실행 시간메모리
844548vjudge1Nivelle (COCI20_nivelle)C++17
13 / 110
1 ms808 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int N = 2e5 + 5, MOD = 1e9 + 7; map<char, int> mp; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, a = 0; 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 = 1; i <= n; i++) { if(str[i] != str[i - 1]) { cnt = 1; if((long double)1 / (long double)cnt < ans) { ans = (long double)1 / (long double)cnt; left = i, right = i; } } else { cnt++; if((long double)1 / (long double)cnt < ans) { ans = (long double)1 / (long double)cnt; left = i - cnt + 1, right = i; } } } cout << left << " " << right << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

nivelle.cpp: In function 'int main()':
nivelle.cpp:14:9: warning: unused variable 'a' [-Wunused-variable]
   14 |  int n, a = 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...