Submission #775321

# Submission time Handle Problem Language Result Execution time Memory
775321 2023-07-06T09:39:22 Z anha3k25cvp Martian DNA (IOI16_dna) C++14
Compilation error
0 ms 0 KB
#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;
}

Compilation message

dna.cpp:8:10: fatal error: dna.cpp: No such file or directory
    8 | #include "dna.cpp"
      |          ^~~~~~~~~
compilation terminated.
grader.cpp: In function 'bool make_test(std::string)':
grader.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 0; i < p.size(); i++) {
      |                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 1; i <= ss.size(); i++) {
      |                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if (pr[i] == p.size()) {