# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
775321 | anha3k25cvp | Martian DNA (IOI16_dna) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dna.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include "dna.cpp"
static std::string s;
static 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;
}
}
std::string ss = p + "#" + s;
std::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;
}
int main() {
int t;
std::cin >> s >> t;
std::string ans = analyse(s.size(), t);
std::cout << tests << std::endl << ans << std::endl;
return 0;
}