Submission #501036

#TimeUsernameProblemLanguageResultExecution timeMemory
501036600MihneaMiners (IOI07_miners)C++17
0 / 100
41 ms588 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); //freopen ("input", "r", stdin); int n; string s; cin >> n >> s; function<int(deque<int>)> eval = [&] (deque<int> d) { set<int> F; for (auto &x : d) { F.insert(x); } return (int) F.size(); }; int sol = 0; deque<int> a, b; for (int i = 1; i <= n; i++) { if ((int) a.size() == 3) a.pop_front(); if ((int) b.size() == 3) b.pop_front(); char ch = s[i - 1]; a.push_back(ch); b.push_back(ch); int X = eval(a); int Y = eval(b); if (X > Y) { b.pop_back(); sol += X; } else { sol += Y; a.pop_back(); } } cout << sol << "\n"; return 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...