제출 #844469

#제출 시각아이디문제언어결과실행 시간메모리
844469vjudge1Nivelle (COCI20_nivelle)C++17
110 / 110
27 ms712 KiB
/* Author : Mychecksdead */ #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 18; int n, ansl = 0, ansr = 0; string s; double best = 2; void solve(){ cin >> n >> s; s = " " + s; for(int j = 1; j <= 26; ++j){ vector<int> a(26); int c = 0, l = 1; for(int i = 1; i <= n; ++i){ if(a[s[i] - 'a'] == 0) c++; a[s[i] - 'a']++; while(c > j){ a[s[l] - 'a']--; if(a[s[l] - 'a'] == 0) c--; l++; } if((double) c / (i-l+1) < best){ best = (double) c / (i-l+1); ansl = l; ansr = i; } } } cout << ansl << ' ' << ansr; } int main(){ cin.tie(0); ios::sync_with_stdio(0); int tt = 1, aa; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // cin >> tt; while(tt--){ solve(); // en; } cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return 0; }

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

nivelle.cpp: In function 'int main()':
nivelle.cpp:43:15: warning: unused variable 'aa' [-Wunused-variable]
   43 |   int tt = 1, aa;
      |               ^~
#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...