제출 #844440

#제출 시각아이디문제언어결과실행 시간메모리
844440vjudge1Nivelle (COCI20_nivelle)C++17
110 / 110
144 ms856 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define s second #define f first typedef long long ll; const ll MOD = 998244353; const ll LOGN = 20; const ll MAXN = 1e6 + 5; int cnt[26]; int main() { fast int N; string s; cin >> N >> s; s = "#" + s; double rate = 10.0; int ansL = -1, ansR = -1; for (int i = 1; i <= 26; i++) { memset(cnt, 0, sizeof(cnt)); set<int> now; int L = 1; for (int R = 1; R <= N; R++) { now.insert(s[R] - 'a'); cnt[s[R] - 'a']++; while (now.size() > i) { cnt[s[L] - 'a']--; if (cnt[s[L] - 'a'] == 0) now.erase(s[L] - 'a'); L++; } int all = R - L + 1; int q = i; double new_rate = ((double)q) / ((double)all); if (new_rate < rate) { rate = new_rate; ansL = L; ansR = R; } } } cout << ansL << " " << ansR << "\n"; }

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

nivelle.cpp: In function 'int main()':
nivelle.cpp:30:22: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |    while (now.size() > i) {
      |           ~~~~~~~~~~~^~~
#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...