#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
mt19937 rnd(11);
}
std::pair<std::string, int> anna(int N, std::string S) {
string t;
for (int i = 0; i < N; ++i) {
int d = (rnd() % 2);
t += "RGB"[rnd()%3];
if (t.back() == S[i]) {
if (t.back() == 'R') {
if (d == 0) {
t.back() = 'G';
} else {
t.back() = 'B';
}
} else if (t.back() == 'G') {
if (d == 0) {
t.back() = 'R';
} else {
t.back() = 'B';
}
} else if (t.back() == 'B') {
if (d == 0) {
t.back() = 'R';
} else {
t.back() = 'G';
}
}
}
}
return make_pair(t, min(N, 41));
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int N;
string s;
string t;
mt19937 rnd(11);
} // namespace
void init(int N, int l) {
::N = N;
for (int i = 0; i < N; ++i) {
int d = rnd() % 2;
s += "RGB"[rnd()%3];
t += 'X';
if (s.back() == 'R') {
if (d == 0) {
t.back() = 'G';
} else {
t.back() = 'B';
}
} else if (s.back() == 'G') {
if (d == 0) {
t.back() = 'R';
} else {
t.back() = 'B';
}
} else if (s.back() == 'B') {
if (d == 0) {
t.back() = 'R';
} else {
t.back() = 'G';
}
}
}
}
int bruno(std::string u) {
int best = -1;
int bestcnt = -1;
for (int i = 0; i <= s.size() - u.size(); ++i) {
bool ok = true;
int cnt = 0;
for (int j = 0; j < u.size(); ++j) {
if (s[i + j] == u[j] || (t[i + j] == u[j])) {
cnt += (s[i + j] == u[j]);
continue;
}
ok = false;
break;
}
if (ok) {
if (bestcnt < cnt) {
bestcnt = cnt;
best = i;
}
}
}
assert(best != -1);
return best + 1;
}
| # | 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... |