# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890769 | Sir_Ahmed_Imran | Miners (IOI07_miners) | C++17 | 1559 ms | 860 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.
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long
#define append push_back
#define all(x) (x).begin(),(x).end()
int pwr[20];
void solve(){
string a;
int n,m,o,p,q,r;
cin>>n>>a;
for(int i=pwr[0]=1;i<20;i++)
pwr[i]=pwr[i-1]*2;
set<char> s;
for(int i=o=0;i<pwr[n-1];i++){
vector<char> x,y;
x.append(a[0]);
for(int j=r=1;j<n;j++){
if(i&pwr[j-1]){
m=x.size();
x.append(a[j]);
for(int k=m;k>=max(m-2,0);k--)
s.insert(x[k]);
r+=s.size();
s.clear();
}
else{
m=y.size();
y.append(a[j]);
for(int k=m;k>=max(m-2,0);k--)
s.insert(y[k]);
r+=s.size();
s.clear();
}
}
o=max(o,r);
}
cout<<o;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
solve();
return 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... |