# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
500252 | Mounir | Nivelle (COCI20_nivelle) | C++14 | 70 ms | 928 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define x first
#define y second
//#define int long long
using namespace std;
signed main(){
int nVals; cin >> nVals;
string line; cin >> line;
queue<int> occs[26];
for (int i = 0; i < nVals; ++i)
occs[line[i] - 'a'].push(i);
int l, r;
double res = 2;
for (int deb = 0; deb < nVals; ++deb){
if (deb != 0)
occs[line[deb - 1] - 'a'].pop();
vector<int> dates;
for (int c = 0; c < 26; ++c){
if (!occs[c].empty())
dates.pb(occs[c].front());
}
sort(all(dates));
for (int i = 0; i < sz(dates); ++i){
int maxi = nVals - 1;
if (i + 1 != sz(dates))
maxi = dates[i + 1] - 1;
double resCur = (i + 1)/double(maxi - deb + 1);
if (resCur < res){
res = resCur;
l = deb;
r = maxi;
}
}
}
cout << l + 1 << " " << r + 1 << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |