# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
707777 | TAhmed33 | Miners (IOI07_miners) | C++98 | 1592 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int ans (int pos, vector <char> mine1, vector <char> mine2) {
if (pos == n) {
return 0;
}
mine1.push_back(s[pos]);
int val = 0;
map <char, int> ds;
for (int i = (int)mine1.size() - 1; i >= max(0, (int)mine1.size() - 3); i--) {
ds[mine1[i]]++;
}
int ret = ans(pos + 1, mine1, mine2) + (int)ds.size();
ds.clear();
mine1.pop_back();
mine2.push_back(s[pos]);
for (int i = (int)mine2.size() - 1; i >= max(0, (int)mine2.size() - 3); i--) {
ds[mine2[i]]++;
}
ret = max(ret, ans(pos + 1, mine1, mine2) + (int)ds.size());
return ret;
}
int main () {
cin >> n >> s;
cout << ans(0, {}, {});
}
Compilation message (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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |