# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831475 | 2023-08-20T09:35:25 Z | OrazB | Miners (IOI07_miners) | C++14 | 1500 ms | 24668 KB |
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define ll long long int #define pii pair <int, int> #define pb push_back #define ff first #define ss second const int N = 1e5+5; int n; string s; int nw[26], c[N], A[3], mx = 0, vis[N]; pair<int,pii> dp[N][5]; int T(char c){ if (c == 'M') return 0; if (c == 'B') return 1; return 2; } int F(string str){ int ans = 0; for (int i = 0; i < str.size(); i++){ for (int j = i; j > max(i-3, -1); j--){ A[T(str[j])] = 1; } ans += A[0]+A[1]+A[2]; A[0] = A[1] = A[2] = 0; } return ans; } void bit(int x){ if (x == n){ string a = "", b = ""; for (int i = 0; i < n; i++){ if (c[i]) a += s[i]; else b += s[i]; } mx = max(mx, F(a)+F(b)); return; } for (int i = 0; i < 2; i++){ c[x] = i; bit(x+1); } } int main () { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> s; bit(0); cout << mx; }
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 | 6 ms | 336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 110 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 213 ms | 320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1585 ms | 324 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1568 ms | 468 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1571 ms | 1492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1561 ms | 2772 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1568 ms | 6356 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1580 ms | 18804 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1577 ms | 24668 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |