# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28084 | abcdef6199 | Martian DNA (IOI16_dna) | C++98 | 13 ms | 2024 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;
struct Random {
int mul, add, mod, cur;
Random() {
mul = 1234567891;
add = 126126727;
mod = 1281231167;
cur = 0;
}
int NextRand(int n) {
cur = ((long long) cur * mul + add) % mod;
return cur % n;
}
} Random;
string analyse(int n, int t) {
string ans = "";
int cur = 0;
for (int i = 1; i <= n; ++i) {
int x = Random.NextRand(2);
if (make_test(ans + char(x + 48))) {
ans += char(x + 48);
cur = 0;
}
else {
ans += char(1 - x + 48);
cur++;
}
if (cur == 19) break;
}
int l = (int) ans.size() - cur + 1, r = (int) ans.size(), f = (int) ans.size() - cur;
while (l <= r) {
int mid = (l + r) >> 1;
if (make_test(ans.substr(0, mid))) {
f = mid;
l = mid + 1;
}
else r = mid - 1;
}
ans = ans.substr(0, f);
while (ans.size() < n) {
if (make_test("0" + ans)) ans = "0" + ans;
else ans = "1" + ans;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |