# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
449555 | 2021-08-02T07:05:18 Z | CyberSleeper | Miners (IOI07_miners) | C++14 | 1500 ms | 844 KB |
#include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) #define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl #define fi first #define se second #define mp make_pair #define pb push_back #define ll long long #define ull unsigned long long #define ld long double #define pld pair<ld, ld> #define pli pair<ld, int> #define pii pair<int, int> #define pis pair<int, string> #define pl pair<ll, ll> #define nl '\n' using namespace std; int N; string S, food="MFB"; int main(){ fastio; cin >> N >> S; int ans=0; for(int i=0; i<(1<<N); i++){ string A="", B=""; for(int j=0; j<N; j++){ if(i&(1<<j)) A+=S[j]; else B+=S[j]; } int tmp=0; int cnt[3]={0, 0, 0}; for(int j=0; j<A.size(); j++){ for(int l=0; l<3; l++){ if(A[j]==food[l]){ cnt[l]++; } if(j>2 && A[j-3]==food[l]) cnt[l]--; } for(int l=0; l<3; l++) if(cnt[l]) tmp++; } cnt[0]=cnt[1]=cnt[2]=0; for(int j=0; j<B.size(); j++){ for(int l=0; l<3; l++){ if(B[j]==food[l]){ cnt[l]++; } if(j>2 && B[j-3]==food[l]) cnt[l]--; } for(int l=0; l<3; l++) if(cnt[l]) tmp++; } ans=max(ans, tmp); } cout << ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 288 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 194 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 390 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1567 ms | 204 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 204 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 26 ms | 332 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1573 ms | 344 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 141 ms | 324 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1577 ms | 844 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 716 KB | Output isn't correct |