# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
569554 | 2022-05-27T13:49:28 Z | esomer | Miners (IOI07_miners) | C++17 | 1500 ms | 740 KB |
#include<bits/stdc++.h> using namespace std; #define endl "\n" const int MOD = 1e9 + 7; void solve(){ int n; cin >> n; string s; cin >> s; int best = 0; for(int i = 0; i < (1 << (s.size())); i++){ string s1; string s2; for(int j = 0; j < s.size(); j++){ if(i & (1 << j)) s1 += s[j]; else s2 += s[j]; } int ans = 0; for(int i = 0; i < s1.size(); i++){ bool one = 0; bool two = 0; bool three = 0; for(int j = i; j >= 0 && j >= i - 2; j--){ if(s1[j] == 'F'){ if(!one){ ans++; one = 1; } }else if(s1[j] == 'M'){ if(!two){ ans++; two = 1; } }else if(!three){ ans++; three = 1; } } } for(int i = 0; i < s2.size(); i++){ bool one = 0; bool two = 0; bool three = 0; for(int j = i; j >= 0 && j >= i - 2; j--){ if(s2[j] == 'F'){ if(!one){ ans++; one = 1; } }else if(s2[j] == 'M'){ if(!two){ ans++; two = 1; } }else if(!three){ ans++; three = 1; } } } best = max(best, ans); } cout << best << endl; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //int tt; cin >> tt; int tt = 1; for(int i = 1; i <= tt; i++) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 157 ms | 296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 297 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1566 ms | 212 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1528 ms | 340 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 145 ms | 396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1579 ms | 740 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 596 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |