# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
882879 | 2023-12-04T00:23:07 Z | Matjaz | Miners (IOI07_miners) | C++14 | 1500 ms | 1188 KB |
// // MinersIOI2007.cpp // // // Created by Matjaz Leonardis on 04/12/2023. // #include <iostream> #include <string> #include <vector> using namespace std; // Trying all the different Miners solutions int N; string food; int coal(string s){ int res = 0; for (int i=0;i<s.size();i++){ bool m=false,b=false,f=false; for (int j=i;j>i-3 && j>=0;j--){ if (s[j] == 'M') m = true; if (s[j] == 'F') f = true; if (s[j] == 'B') b = true; } res += m + f + b; } return res; } int main(){ cin >> N; cin >> food; int best = 0; for (int i=0;i<(1<<N);i++){ string mine1; string mine2; for (int j=0;j<N;j++) if ((i&(1<<j)) != 0) mine1 += food[j]; else mine2 += food[j]; best = max(best, coal(mine1) + coal(mine2)); } cout << best << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 125 ms | 408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 233 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1545 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 472 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1550 ms | 496 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 92 ms | 564 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1553 ms | 1188 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |