답안 #320283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320283 2020-11-08T08:20:48 Z spatarel Martian DNA (IOI16_dna) C++17
0 / 100
13 ms 768 KB
#include "dna.h"

#include <cstdlib>

std::string letters[] = {"0", "1"};

std::string analyse(int n, int t) {
  std::string S = "";
  int doubts = 0;
  while (doubts < 19) {
    int guess = rand() % 2;
    std::string testS = letters[guess] + S;
    if (make_test(testS)) {
      S = letters[guess] + S;
      doubts = 0;
    } else {
      S = letters[1 - guess] + S;
      doubts++;
    }
  }
  
  for (int step = 16; step > 0; step /= 2) {
    std::string testS = S.substr(step);
    if (!make_test(testS)) {
      S = S.substr(step);
    }
  }
  S = S.substr(1);
  
  while ((int)S.size() < n) {
    int guess = rand() % 2;
    std::string testS = S + letters[guess];
    if (make_test(testS)) {
      S = S + letters[guess];
    } else {
      S = S + letters[1 - guess];
    }
  }
  return S;
}

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()) {
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 5 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
9 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
10 Correct 1 ms 364 KB Output is correct
11 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
12 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
13 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
17 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
18 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
22 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
23 Runtime error 4 ms 576 KB Execution killed with signal 6 (could be triggered by violating memory limits)
24 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 3 ms 768 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Runtime error 4 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
15 Correct 1 ms 364 KB Output is correct
16 Runtime error 3 ms 640 KB Execution killed with signal 6 (could be triggered by violating memory limits)
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
27 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
3 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
4 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
5 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
6 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
7 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 11 ms 492 KB Output is correct
23 Correct 10 ms 492 KB Output is correct
24 Correct 10 ms 492 KB Output is correct
25 Correct 13 ms 492 KB Output is correct
26 Correct 9 ms 492 KB Output is correct
27 Correct 9 ms 492 KB Output is correct
28 Correct 8 ms 492 KB Output is correct
29 Correct 9 ms 492 KB Output is correct
30 Correct 9 ms 492 KB Output is correct
31 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
32 Runtime error 3 ms 620 KB Execution killed with signal 6 (could be triggered by violating memory limits)
33 Correct 8 ms 492 KB Output is correct
34 Correct 8 ms 492 KB Output is correct
35 Correct 10 ms 492 KB Output is correct
36 Correct 8 ms 492 KB Output is correct
37 Correct 8 ms 492 KB Output is correct
38 Correct 9 ms 492 KB Output is correct
39 Correct 9 ms 640 KB Output is correct