Submission #1040271

#TimeUsernameProblemLanguageResultExecution timeMemory
1040271shezittMiners (IOI07_miners)C++14
45 / 100
1590 ms856 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define int ll #define fore(a, b, c) for(int a=b; a<c; ++a) #define vi vector<int> #define pb push_back #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define F first #define S second #define ii pair<int,int> #define dbg(x) cerr << #x << ": " << x << endl #define raya cerr << "=============" << endl int n; string s; int calc(string &cur){ set<char> st; for(int i=sz(cur)-1; i>=max(0ll, sz(cur)-3); --i){ st.insert(cur[i]); } return sz(st); } signed main(){ cin >> n; cin >> s; int ans = 0; for(int mask=0; mask<(1<<n); ++mask){ string mine1, mine2; int res = 0; fore(i, 0, n) { if((mask >> i) & 1){ // mine1 mine1.pb(s[i]); res += calc(mine1); } else { // mine2 mine2.pb(s[i]); res += calc(mine2); } } ans = max(ans, res); } cout << ans << endl; }
#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...