Submission #592823

# Submission time Handle Problem Language Result Execution time Memory
592823 2022-07-09T16:22:21 Z tarche Martian DNA (IOI16_dna) C++17
0 / 100
12 ms 408 KB
#include "dna.h"

#include <bits/stdc++.h>

using namespace std;

int lengthLongestZeroChain(int n) {
  int low = 0, high = n;
  while (low + 1 < high) {
    int mid = (low + high) / 2;
    string s(mid, '0');
    if (make_test(s)) {
      low = mid;
    } else {
      high = mid;
    }
  }

  return low;
}

void findStringEnding(string& s, string& chain) {
  int n = (int)chain.length();
  int low = 0, high = n;
  while (low + 1 < high) {
    int mid = (low + high) / 2;
    chain = string(mid, '0');
    if (make_test(s + chain)) {
      low = mid;
    } else {
      high = mid;
    }
  }

  cout << low << '\n';
  s += string(low, '0');
}

void growSubstringRight(string& s, string& chain) {
  if (make_test(s + chain + '1')) {
    s += chain + '1';
    chain = "";
  } else {
    chain += '0';
  }
}

void growSubstringLeft(string& s) {
  if (make_test('1' + s)) {
    s = "1" + s;
  } else {
    s = "0" + s;
  }
}

string analyse(int n, int t) {
  int zeroChainLen = lengthLongestZeroChain(n);
  cout << zeroChainLen << '\n';
  string curr(zeroChainLen, '0'), chain = "";
  while ((int)chain.length() <= zeroChainLen && (int)curr.length() < n) {
    growSubstringRight(curr, chain);
  }

  findStringEnding(curr, chain);

  while ((int)curr.length() < n) {
    growSubstringLeft(curr);
  }

  return curr;
}

Compilation message

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()) {
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Secret is incorrect!
2 Incorrect 0 ms 212 KB Secret is incorrect!
3 Incorrect 0 ms 212 KB Secret is incorrect!
4 Incorrect 0 ms 212 KB Secret is incorrect!
5 Incorrect 0 ms 212 KB Secret is incorrect!
6 Incorrect 0 ms 212 KB Secret is incorrect!
7 Incorrect 0 ms 212 KB Secret is incorrect!
8 Incorrect 0 ms 212 KB Secret is incorrect!
9 Incorrect 0 ms 212 KB Secret is incorrect!
10 Incorrect 0 ms 212 KB Secret is incorrect!
11 Incorrect 0 ms 212 KB Secret is incorrect!
12 Incorrect 1 ms 212 KB Secret is incorrect!
13 Incorrect 0 ms 212 KB Secret is incorrect!
14 Incorrect 1 ms 212 KB Secret is incorrect!
15 Incorrect 1 ms 212 KB Secret is incorrect!
16 Incorrect 0 ms 212 KB Secret is incorrect!
17 Incorrect 0 ms 212 KB Secret is incorrect!
18 Incorrect 0 ms 212 KB Secret is incorrect!
19 Incorrect 0 ms 212 KB Secret is incorrect!
20 Incorrect 0 ms 212 KB Secret is incorrect!
21 Incorrect 0 ms 212 KB Secret is incorrect!
22 Incorrect 0 ms 212 KB Secret is incorrect!
23 Incorrect 0 ms 212 KB Secret is incorrect!
24 Incorrect 0 ms 212 KB Secret is incorrect!
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Secret is incorrect!
2 Incorrect 1 ms 212 KB Secret is incorrect!
3 Incorrect 0 ms 212 KB Secret is incorrect!
4 Incorrect 0 ms 212 KB Secret is incorrect!
5 Incorrect 0 ms 212 KB Secret is incorrect!
6 Incorrect 0 ms 212 KB Secret is incorrect!
7 Incorrect 0 ms 212 KB Secret is incorrect!
8 Incorrect 0 ms 212 KB Secret is incorrect!
9 Incorrect 1 ms 212 KB Secret is incorrect!
10 Incorrect 0 ms 212 KB Secret is incorrect!
11 Incorrect 1 ms 212 KB Secret is incorrect!
12 Incorrect 1 ms 212 KB Secret is incorrect!
13 Incorrect 0 ms 212 KB Secret is incorrect!
14 Incorrect 1 ms 212 KB Secret is incorrect!
15 Incorrect 0 ms 212 KB Secret is incorrect!
16 Incorrect 0 ms 212 KB Secret is incorrect!
17 Incorrect 0 ms 212 KB Secret is incorrect!
18 Incorrect 1 ms 212 KB Secret is incorrect!
19 Incorrect 1 ms 212 KB Secret is incorrect!
20 Incorrect 1 ms 212 KB Secret is incorrect!
21 Incorrect 1 ms 212 KB Secret is incorrect!
22 Incorrect 0 ms 212 KB Secret is incorrect!
23 Incorrect 1 ms 212 KB Secret is incorrect!
24 Incorrect 0 ms 212 KB Secret is incorrect!
25 Incorrect 0 ms 212 KB Secret is incorrect!
26 Incorrect 0 ms 212 KB Secret is incorrect!
27 Incorrect 1 ms 212 KB Secret is incorrect!
28 Incorrect 1 ms 212 KB Secret is incorrect!
29 Incorrect 1 ms 212 KB Secret is incorrect!
30 Incorrect 1 ms 212 KB Secret is incorrect!
31 Incorrect 1 ms 212 KB Secret is incorrect!
32 Incorrect 1 ms 212 KB Secret is incorrect!
33 Incorrect 1 ms 212 KB Secret is incorrect!
34 Incorrect 0 ms 212 KB Secret is incorrect!
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Secret is incorrect!
2 Incorrect 0 ms 212 KB Secret is incorrect!
3 Incorrect 1 ms 212 KB Secret is incorrect!
4 Incorrect 0 ms 212 KB Secret is incorrect!
5 Incorrect 0 ms 212 KB Secret is incorrect!
6 Incorrect 0 ms 212 KB Secret is incorrect!
7 Incorrect 0 ms 212 KB Secret is incorrect!
8 Incorrect 0 ms 212 KB Secret is incorrect!
9 Incorrect 0 ms 212 KB Secret is incorrect!
10 Incorrect 0 ms 212 KB Secret is incorrect!
11 Incorrect 0 ms 212 KB Secret is incorrect!
12 Incorrect 1 ms 212 KB Secret is incorrect!
13 Incorrect 1 ms 212 KB Secret is incorrect!
14 Incorrect 1 ms 212 KB Secret is incorrect!
15 Incorrect 0 ms 212 KB Secret is incorrect!
16 Incorrect 0 ms 212 KB Secret is incorrect!
17 Incorrect 1 ms 212 KB Secret is incorrect!
18 Incorrect 1 ms 212 KB Secret is incorrect!
19 Incorrect 1 ms 212 KB Secret is incorrect!
20 Incorrect 0 ms 212 KB Secret is incorrect!
21 Incorrect 0 ms 212 KB Secret is incorrect!
22 Incorrect 8 ms 376 KB Secret is incorrect!
23 Incorrect 9 ms 340 KB Secret is incorrect!
24 Incorrect 8 ms 332 KB Secret is incorrect!
25 Incorrect 12 ms 408 KB Secret is incorrect!
26 Incorrect 11 ms 344 KB Secret is incorrect!
27 Incorrect 6 ms 380 KB Secret is incorrect!
28 Incorrect 6 ms 340 KB Secret is incorrect!
29 Incorrect 12 ms 344 KB Secret is incorrect!
30 Incorrect 5 ms 340 KB Secret is incorrect!
31 Incorrect 5 ms 340 KB Secret is incorrect!
32 Incorrect 12 ms 340 KB Secret is incorrect!
33 Incorrect 8 ms 340 KB Secret is incorrect!
34 Incorrect 8 ms 360 KB Secret is incorrect!
35 Incorrect 7 ms 340 KB Secret is incorrect!
36 Incorrect 8 ms 388 KB Secret is incorrect!
37 Incorrect 7 ms 388 KB Secret is incorrect!
38 Incorrect 4 ms 340 KB Secret is incorrect!
39 Incorrect 10 ms 324 KB Secret is incorrect!