Submission #92918

# Submission time Handle Problem Language Result Execution time Memory
92918 2019-01-05T15:53:36 Z dim131 Martian DNA (IOI16_dna) C++14
0 / 100
13 ms 420 KB
#include "dna.h"

#include <cstdlib>
#include <iostream>

std::string generatek01(int k) {
  std::string seq;
  for (int i = 0; i < k; ++i) {
    seq += "01";
  }
  return seq;
}

int findLargest01(int n, int t) {
  int st = 0, en = n /2;
  while (st < en) {
    int mid = (st + en + 1) / 2;
	if (make_test(generatek01(mid))) {
	  st = mid;
	} else {
	  en = mid - 1;
	}
  }
  return st;
}

char otherChar(char c) {
  return c == '0' ? '1' : '0';
}

std::string analyse(int n, int t) {
    int len = findLargest01(n, t);
	std::cout << "Largest was " << len << std::endl;
	int unverified_len = 0;
	char currentChar = '0';
	std::string seq = generatek01(len);
	len *= 2;
	// Find right.
	while(true) {
	  if (make_test(seq + currentChar)) {
	    unverified_len = 0;
		seq += currentChar;
	  } else {
		currentChar = otherChar(currentChar);
		seq += currentChar;
		++unverified_len;
	  }
	  if (unverified_len > len || seq.size() > n) break;
	}
	int normal_len = seq.size() - unverified_len;
	// Binary search verified length. 
	int st = 0, en = unverified_len;
	while (st < en) {
	  int mid = (st + en + 1) / 2;
	  if (make_test(seq.substr(0, normal_len + mid))) st = mid;
      else en = mid - 1;
	}
    seq = seq.substr(0, normal_len + st);
	std::cout << "Normal string : " <<  seq << std::endl;
	normal_len = seq.size();
    for (int i = normal_len; i < n; ++i) {
      if (make_test('0' + seq)) {
        seq = '0' + seq;
      } else seq = '1' + seq;
    }	  
	std::cout << "Found " << seq << std::endl;
    return seq;
}                    

Compilation message

dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:48:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (unverified_len > len || seq.size() > n) break;
                                ~~~~~~~~~~~^~~
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < p.size(); i++) {
                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i <= ss.size(); i++) {
                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pr[i] == p.size()) {
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Secret is incorrect!
2 Incorrect 2 ms 256 KB Secret is incorrect!
3 Incorrect 2 ms 376 KB Secret is incorrect!
4 Incorrect 2 ms 256 KB Secret is incorrect!
5 Incorrect 2 ms 376 KB Secret is incorrect!
6 Incorrect 2 ms 376 KB Secret is incorrect!
7 Incorrect 2 ms 256 KB Secret is incorrect!
8 Incorrect 2 ms 376 KB Secret is incorrect!
9 Incorrect 2 ms 252 KB Secret is incorrect!
10 Incorrect 2 ms 256 KB Secret is incorrect!
11 Incorrect 2 ms 376 KB Secret is incorrect!
12 Incorrect 2 ms 376 KB Secret is incorrect!
13 Incorrect 2 ms 380 KB Secret is incorrect!
14 Incorrect 2 ms 376 KB Secret is incorrect!
15 Incorrect 2 ms 256 KB Secret is incorrect!
16 Incorrect 2 ms 256 KB Secret is incorrect!
17 Incorrect 2 ms 256 KB Secret is incorrect!
18 Incorrect 2 ms 376 KB Secret is incorrect!
19 Incorrect 2 ms 376 KB Secret is incorrect!
20 Incorrect 2 ms 256 KB Secret is incorrect!
21 Incorrect 2 ms 256 KB Secret is incorrect!
22 Incorrect 2 ms 256 KB Secret is incorrect!
23 Incorrect 2 ms 376 KB Secret is incorrect!
24 Incorrect 2 ms 256 KB Secret is incorrect!
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Secret is incorrect!
2 Incorrect 2 ms 256 KB Secret is incorrect!
3 Incorrect 2 ms 376 KB Secret is incorrect!
4 Incorrect 2 ms 256 KB Secret is incorrect!
5 Incorrect 2 ms 376 KB Secret is incorrect!
6 Incorrect 2 ms 376 KB Secret is incorrect!
7 Incorrect 2 ms 376 KB Secret is incorrect!
8 Incorrect 2 ms 256 KB Secret is incorrect!
9 Incorrect 2 ms 256 KB Secret is incorrect!
10 Incorrect 1 ms 256 KB Secret is incorrect!
11 Incorrect 2 ms 376 KB Secret is incorrect!
12 Incorrect 2 ms 256 KB Secret is incorrect!
13 Incorrect 2 ms 256 KB Secret is incorrect!
14 Incorrect 2 ms 256 KB Secret is incorrect!
15 Incorrect 2 ms 376 KB Secret is incorrect!
16 Incorrect 2 ms 252 KB Secret is incorrect!
17 Incorrect 2 ms 256 KB Secret is incorrect!
18 Incorrect 2 ms 256 KB Secret is incorrect!
19 Incorrect 2 ms 256 KB Secret is incorrect!
20 Incorrect 2 ms 256 KB Secret is incorrect!
21 Incorrect 2 ms 256 KB Secret is incorrect!
22 Incorrect 2 ms 376 KB Secret is incorrect!
23 Incorrect 2 ms 376 KB Secret is incorrect!
24 Incorrect 2 ms 376 KB Secret is incorrect!
25 Incorrect 2 ms 376 KB Secret is incorrect!
26 Incorrect 2 ms 376 KB Secret is incorrect!
27 Incorrect 2 ms 256 KB Secret is incorrect!
28 Incorrect 2 ms 256 KB Secret is incorrect!
29 Incorrect 2 ms 256 KB Secret is incorrect!
30 Incorrect 2 ms 376 KB Secret is incorrect!
31 Incorrect 2 ms 256 KB Secret is incorrect!
32 Incorrect 2 ms 256 KB Secret is incorrect!
33 Incorrect 2 ms 256 KB Secret is incorrect!
34 Incorrect 2 ms 256 KB Secret is incorrect!
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Secret is incorrect!
2 Incorrect 2 ms 256 KB Secret is incorrect!
3 Incorrect 2 ms 256 KB Secret is incorrect!
4 Incorrect 2 ms 376 KB Secret is incorrect!
5 Incorrect 2 ms 376 KB Secret is incorrect!
6 Incorrect 2 ms 376 KB Secret is incorrect!
7 Incorrect 2 ms 256 KB Secret is incorrect!
8 Incorrect 2 ms 256 KB Secret is incorrect!
9 Incorrect 2 ms 376 KB Secret is incorrect!
10 Incorrect 2 ms 380 KB Secret is incorrect!
11 Incorrect 2 ms 376 KB Secret is incorrect!
12 Incorrect 2 ms 376 KB Secret is incorrect!
13 Incorrect 2 ms 376 KB Secret is incorrect!
14 Incorrect 2 ms 376 KB Secret is incorrect!
15 Incorrect 2 ms 376 KB Secret is incorrect!
16 Incorrect 2 ms 256 KB Secret is incorrect!
17 Incorrect 2 ms 376 KB Secret is incorrect!
18 Incorrect 2 ms 256 KB Secret is incorrect!
19 Incorrect 2 ms 376 KB Secret is incorrect!
20 Incorrect 2 ms 376 KB Secret is incorrect!
21 Incorrect 2 ms 376 KB Secret is incorrect!
22 Incorrect 10 ms 376 KB Secret is incorrect!
23 Incorrect 12 ms 376 KB Secret is incorrect!
24 Incorrect 10 ms 376 KB Secret is incorrect!
25 Incorrect 12 ms 376 KB Secret is incorrect!
26 Incorrect 13 ms 376 KB Secret is incorrect!
27 Incorrect 2 ms 376 KB Secret is incorrect!
28 Incorrect 2 ms 376 KB Secret is incorrect!
29 Incorrect 7 ms 380 KB Secret is incorrect!
30 Incorrect 10 ms 380 KB Secret is incorrect!
31 Incorrect 7 ms 376 KB Secret is incorrect!
32 Incorrect 7 ms 376 KB Secret is incorrect!
33 Incorrect 9 ms 420 KB Secret is incorrect!
34 Incorrect 9 ms 376 KB Secret is incorrect!
35 Incorrect 8 ms 380 KB Secret is incorrect!
36 Incorrect 9 ms 376 KB Secret is incorrect!
37 Incorrect 8 ms 376 KB Secret is incorrect!
38 Incorrect 9 ms 376 KB Secret is incorrect!
39 Incorrect 9 ms 376 KB Secret is incorrect!