Submission #406482

# Submission time Handle Problem Language Result Execution time Memory
406482 2021-05-17T16:24:00 Z Alma Martian DNA (IOI16_dna) C++17
0 / 100
1000 ms 328 KB
#include <bits/stdc++.h>
#include "dna.h"
using namespace std;
 
string analyse(int n, int t) {
    string p = "";
    int max_0 = 0, max_1 = 0;
 
    int lo = 0, mid, hi = n;
    while (lo <= hi) {
        mid = (lo + hi) / 2;
        p = '0' * mid;
        if (make_test(p)) {
            lo = max_0 = mid;
        } else {
            hi = mid;
        }
    }
    lo = 0; hi = n;
    while (lo <= hi) {
        mid = (lo + hi) / 2;
        p = '1' * mid;
        if (make_test(p)) {
            max_1 = mid;
          	lo = mid+1;
        } else {
            hi = mid-1;
        }
    }
 
 
    bool zero, one;
    int num_0 = 0, num_1 = 0;
    p = "";
    while ((int)p.size() < n) {
        if (num_0 < max_0) zero = make_test(p + '0');
        if (num_0 < max_0 && zero) {
            p += '0';
            num_0++; num_1 = 0;
            continue;
        }
        if (num_1 < max_1) one = make_test(p + '1');
        if (num_1 < max_1 && one) {
            p += '1';
            num_1++; num_0 = 0;
            continue;
        }
        break;
    }
    if ((int)p.size() == n) return p;
    while ((int)p.size() < n) {
        zero = make_test('0' + p);
        if (zero) {
            p = '0' + p;
            continue;
        }
        p = '1' + p;
    }
    return p;
}

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 Execution timed out 1089 ms 204 KB Time limit exceeded
2 Execution timed out 1097 ms 204 KB Time limit exceeded
3 Execution timed out 1089 ms 204 KB Time limit exceeded
4 Execution timed out 1089 ms 204 KB Time limit exceeded
5 Execution timed out 1098 ms 204 KB Time limit exceeded
6 Execution timed out 1090 ms 204 KB Time limit exceeded
7 Execution timed out 1089 ms 204 KB Time limit exceeded
8 Execution timed out 1082 ms 204 KB Time limit exceeded
9 Execution timed out 1088 ms 204 KB Time limit exceeded
10 Execution timed out 1087 ms 204 KB Time limit exceeded
11 Execution timed out 1078 ms 204 KB Time limit exceeded
12 Execution timed out 1087 ms 204 KB Time limit exceeded
13 Execution timed out 1088 ms 204 KB Time limit exceeded
14 Execution timed out 1085 ms 204 KB Time limit exceeded
15 Execution timed out 1086 ms 204 KB Time limit exceeded
16 Execution timed out 1080 ms 204 KB Time limit exceeded
17 Execution timed out 1085 ms 204 KB Time limit exceeded
18 Execution timed out 1061 ms 204 KB Time limit exceeded
19 Execution timed out 1076 ms 204 KB Time limit exceeded
20 Execution timed out 1090 ms 204 KB Time limit exceeded
21 Execution timed out 1093 ms 204 KB Time limit exceeded
22 Execution timed out 1064 ms 204 KB Time limit exceeded
23 Execution timed out 1094 ms 204 KB Time limit exceeded
24 Execution timed out 1087 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 204 KB Time limit exceeded
2 Execution timed out 1096 ms 204 KB Time limit exceeded
3 Execution timed out 1091 ms 204 KB Time limit exceeded
4 Execution timed out 1086 ms 204 KB Time limit exceeded
5 Execution timed out 1092 ms 204 KB Time limit exceeded
6 Execution timed out 1077 ms 204 KB Time limit exceeded
7 Execution timed out 1084 ms 204 KB Time limit exceeded
8 Execution timed out 1091 ms 204 KB Time limit exceeded
9 Execution timed out 1097 ms 204 KB Time limit exceeded
10 Execution timed out 1086 ms 204 KB Time limit exceeded
11 Execution timed out 1093 ms 204 KB Time limit exceeded
12 Execution timed out 1096 ms 204 KB Time limit exceeded
13 Execution timed out 1084 ms 204 KB Time limit exceeded
14 Execution timed out 1093 ms 204 KB Time limit exceeded
15 Execution timed out 1081 ms 204 KB Time limit exceeded
16 Execution timed out 1096 ms 204 KB Time limit exceeded
17 Execution timed out 1088 ms 204 KB Time limit exceeded
18 Execution timed out 1090 ms 204 KB Time limit exceeded
19 Execution timed out 1065 ms 204 KB Time limit exceeded
20 Execution timed out 1087 ms 204 KB Time limit exceeded
21 Execution timed out 1076 ms 204 KB Time limit exceeded
22 Execution timed out 1086 ms 204 KB Time limit exceeded
23 Execution timed out 1073 ms 204 KB Time limit exceeded
24 Execution timed out 1082 ms 204 KB Time limit exceeded
25 Execution timed out 1048 ms 204 KB Time limit exceeded
26 Execution timed out 1038 ms 204 KB Time limit exceeded
27 Execution timed out 1079 ms 204 KB Time limit exceeded
28 Execution timed out 1095 ms 204 KB Time limit exceeded
29 Execution timed out 1086 ms 204 KB Time limit exceeded
30 Execution timed out 1083 ms 204 KB Time limit exceeded
31 Execution timed out 1081 ms 204 KB Time limit exceeded
32 Execution timed out 1081 ms 204 KB Time limit exceeded
33 Execution timed out 1094 ms 204 KB Time limit exceeded
34 Execution timed out 1098 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 204 KB Time limit exceeded
2 Execution timed out 1088 ms 204 KB Time limit exceeded
3 Execution timed out 1095 ms 204 KB Time limit exceeded
4 Execution timed out 1093 ms 204 KB Time limit exceeded
5 Execution timed out 1091 ms 204 KB Time limit exceeded
6 Execution timed out 1088 ms 204 KB Time limit exceeded
7 Execution timed out 1062 ms 204 KB Time limit exceeded
8 Execution timed out 1068 ms 204 KB Time limit exceeded
9 Execution timed out 1054 ms 328 KB Time limit exceeded
10 Execution timed out 1092 ms 204 KB Time limit exceeded
11 Execution timed out 1042 ms 204 KB Time limit exceeded
12 Execution timed out 1083 ms 204 KB Time limit exceeded
13 Execution timed out 1094 ms 204 KB Time limit exceeded
14 Execution timed out 1092 ms 204 KB Time limit exceeded
15 Execution timed out 1088 ms 204 KB Time limit exceeded
16 Execution timed out 1091 ms 204 KB Time limit exceeded
17 Execution timed out 1091 ms 204 KB Time limit exceeded
18 Execution timed out 1085 ms 204 KB Time limit exceeded
19 Execution timed out 1094 ms 204 KB Time limit exceeded
20 Execution timed out 1092 ms 204 KB Time limit exceeded
21 Execution timed out 1082 ms 204 KB Time limit exceeded
22 Execution timed out 1090 ms 204 KB Time limit exceeded
23 Execution timed out 1075 ms 204 KB Time limit exceeded
24 Execution timed out 1094 ms 204 KB Time limit exceeded
25 Execution timed out 1087 ms 204 KB Time limit exceeded
26 Execution timed out 1079 ms 204 KB Time limit exceeded
27 Execution timed out 1088 ms 204 KB Time limit exceeded
28 Execution timed out 1080 ms 204 KB Time limit exceeded
29 Execution timed out 1079 ms 204 KB Time limit exceeded
30 Execution timed out 1092 ms 204 KB Time limit exceeded
31 Execution timed out 1073 ms 204 KB Time limit exceeded
32 Execution timed out 1082 ms 204 KB Time limit exceeded
33 Execution timed out 1087 ms 204 KB Time limit exceeded
34 Execution timed out 1081 ms 204 KB Time limit exceeded
35 Execution timed out 1061 ms 204 KB Time limit exceeded
36 Execution timed out 1082 ms 204 KB Time limit exceeded
37 Execution timed out 1085 ms 204 KB Time limit exceeded
38 Execution timed out 1093 ms 204 KB Time limit exceeded
39 Execution timed out 1094 ms 204 KB Time limit exceeded