| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 868766 | Pring | Nivelle (COCI20_nivelle) | C++14 | 56 ms | 1620 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fs first
#define sc second
#define mp make_pair
typedef pair<int, int> pii;
typedef pair<pii, int> p3i;
const int MXN = 100005, MXC = 26;
int n;
string s;
deque<int> dq[MXC];
pii ans;
double x = 3000000000000000000.0;
void miku() {
cin >> n >> s;
for (int i = 0; i < n; i++) {
dq[s[i] - 'a'].push_back(i);
}
for (int i = 0; i < MXC; i++) dq[i].push_back(-1);
for (int i = 0; i < n; i++) {
vector<int> v;
for (int j = 0; j < MXC; j++) if (dq[j].front() != -1) v.push_back(dq[j].front());
v.push_back(n);
sort(v.begin(), v.end());
// cout << i << endl;
// for (auto &j : v) cout << j << ' ';
// cout << endl;
for (int j = 1; j < v.size(); j++) {
double xx = (double) j / (v[j] - i);
if (xx < x) {
x = xx;
ans = mp(i, v[j]);
}
}
dq[s[i] - 'a'].pop_front();
}
cout << ans.fs + 1 << ' ' << ans.sc << endl;
}
int32_t main() {
cin.tie(0) -> sync_with_stdio(false);
miku();
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... | ||||
