Submission #707735

#TimeUsernameProblemLanguageResultExecution timeMemory
707735TAhmed33Miners (IOI07_miners)C++98
45 / 100
1597 ms524288 KiB
#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]); 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, {}, {}); }
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...