이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Aber der schlimmste Fiend, dem du begegnen kannst, wirst du immer dir selber sein
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define pb push_back
#define rev reverse
#define all(x) x.begin(),x.end()
#define acc accumulate
#define sz size()
#define MOD 1000000007
#define rall(x) x.rbegin(),x.rend()
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const int N = 1e6 + 5;
inline void solve(){
double n;
string s;
cin >> n >> s;
double ok[26], cnt = 0, l, r;
fill(ok, ok+26, 0);
double mn = n +5;
rep(i, 0, n){
rep(j, i, n){
if(!ok[s[j] - 'a']){
ok[s[j] - 'a'] = 1;
cnt++;
}
double ans = cnt / (j-i+1);
if(mn > ans){
mn = ans;
l = i, r = j;
}
}
cnt = 0;
fill(ok, ok+26, 0);
}
cout << l+1 << " " << r+1 << endl;
}
int main(){
fast_io
int t;
t = 1;
while(t--) solve();
}
컴파일 시 표준 에러 (stderr) 메시지
nivelle.cpp: In function 'void solve()':
nivelle.cpp:41:29: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
41 | cout << l+1 << " " << r+1 << endl;
| ^
nivelle.cpp:41:15: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
41 | cout << l+1 << " " << r+1 << endl;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |