# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
831453 | Halym2007 | Martian DNA (IOI16_dna) | C++11 | 17 ms | 404 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 <bits/stdc++.h>
using namespace std;
#include "dna.h"
//string s;
//int tests;
//
//bool make_test(std::string p) {
// tests++;
// for (int i = 0; i < p.size(); i++) {
// if (p[i] != '0' && p[i] != '1') {
// return false;
// }
// }
// string ss = p + "#" + s;
// vector<int> pr(ss.size() + 1);
// pr[0] = -1;
// bool answer = false;
// for (int i = 1; i <= ss.size(); i++) {
// int k = pr[i - 1];
// while (k >= 0 && ss[k] != ss[i - 1])
// k = pr[k];
// pr[i] = k + 1;
// if (pr[i] == p.size()) {
// answer = true;
// break;
// }
// }
// return answer;
//}
string analyse(int n, int t) {
bool a1 = make_test ("0");
bool a2 = make_test ("1");
string jog = "";
if (!a1 and !a2) return jog;
if (!a1) {
while (make_test(jog + "1")) {
jog += '1';
}
return jog;
}
else if (!a2) {
while (make_test(jog + "0")) {
jog += '0';
}
return jog;
}
while (1) {
if (make_test(jog + "0")) {
jog += '0';
}
else if (make_test(jog + "1")) {
jog += '1';
}
else break;
}
while (1) {
if (make_test("0" + jog)) {
jog = '0' + jog;
}
else if (make_test("1" + jog)) {
jog = '1' + jog;
}
else break;
}
return jog;
}
//int main() {
// int t;
// cin >> s >> t;
// string ans = analyse(s.size(), t);
// cout << tests << endl << ans << endl;
// return 0;
//}
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... |