Submission #562975

# Submission time Handle Problem Language Result Execution time Memory
562975 2022-05-16T01:33:42 Z Spade1 Martian DNA (IOI16_dna) C++14
0 / 100
1000 ms 556 KB
#include<bits/stdc++.h>
#include "dna.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;

string analyse(int n, int t) {
    int l = 0, r = n;
    while (l < r) {
        int mid = (l+r)/2;
        string test;
        for (int i = 1; i <= mid; ++i) test += "1";
        if (make_test(test)) l = mid;
        else r = mid-1;
    }

    int _max = l;

    string s;
    for (int i = 1; i <= _max; ++i) s += "1";
    int cnt = _max;
    while (cnt <= _max) {
        if (make_test(s + "0")) {
            s += "0";
            cnt = 0;
        }
        else {
            s += "1";
            cnt++;
        }
    }

    while (!s.empty() && s.back() == '1') {
        s.erase(s.back());
    }

    l = 0, r = _max;
    while (l < r) {
        int mid = (l+r)/2;
        string test = s;
        for (int i = 1; i <= mid; ++i) test += "1";
        if (make_test(test)) l = mid;
        else r = mid-1;
    }

    for (int i = 1; i <= l; ++i) s += "1";

    while (s.size() < n) {
        if (make_test("0" + s)) s = "0" + s;
        else s = "1" + s;
    }

    return s;
}

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:54:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   54 |     while (s.size() < n) {
      |            ~~~~~~~~~^~~
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 212 KB Time limit exceeded
2 Execution timed out 1088 ms 212 KB Time limit exceeded
3 Runtime error 3 ms 468 KB Execution killed with signal 6
4 Execution timed out 1093 ms 212 KB Time limit exceeded
5 Execution timed out 1091 ms 212 KB Time limit exceeded
6 Execution timed out 1084 ms 212 KB Time limit exceeded
7 Execution timed out 1088 ms 212 KB Time limit exceeded
8 Execution timed out 1090 ms 212 KB Time limit exceeded
9 Execution timed out 1085 ms 212 KB Time limit exceeded
10 Execution timed out 1091 ms 212 KB Time limit exceeded
11 Execution timed out 1072 ms 212 KB Time limit exceeded
12 Execution timed out 1054 ms 336 KB Time limit exceeded
13 Execution timed out 1087 ms 212 KB Time limit exceeded
14 Execution timed out 1087 ms 212 KB Time limit exceeded
15 Execution timed out 1083 ms 212 KB Time limit exceeded
16 Execution timed out 1089 ms 212 KB Time limit exceeded
17 Execution timed out 1047 ms 212 KB Time limit exceeded
18 Execution timed out 1080 ms 212 KB Time limit exceeded
19 Execution timed out 1090 ms 212 KB Time limit exceeded
20 Runtime error 2 ms 468 KB Execution killed with signal 6
21 Runtime error 3 ms 468 KB Execution killed with signal 6
22 Execution timed out 1090 ms 212 KB Time limit exceeded
23 Runtime error 3 ms 468 KB Execution killed with signal 6
24 Runtime error 2 ms 556 KB Execution killed with signal 6
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 212 KB Time limit exceeded
2 Execution timed out 1071 ms 212 KB Time limit exceeded
3 Runtime error 2 ms 468 KB Execution killed with signal 6
4 Execution timed out 1093 ms 212 KB Time limit exceeded
5 Execution timed out 1051 ms 212 KB Time limit exceeded
6 Execution timed out 1080 ms 212 KB Time limit exceeded
7 Runtime error 4 ms 468 KB Execution killed with signal 6
8 Execution timed out 1082 ms 212 KB Time limit exceeded
9 Runtime error 2 ms 468 KB Execution killed with signal 6
10 Execution timed out 1080 ms 212 KB Time limit exceeded
11 Execution timed out 1091 ms 212 KB Time limit exceeded
12 Runtime error 2 ms 468 KB Execution killed with signal 6
13 Runtime error 2 ms 468 KB Execution killed with signal 6
14 Execution timed out 1085 ms 212 KB Time limit exceeded
15 Runtime error 2 ms 468 KB Execution killed with signal 6
16 Execution timed out 1087 ms 212 KB Time limit exceeded
17 Execution timed out 1080 ms 212 KB Time limit exceeded
18 Runtime error 2 ms 468 KB Execution killed with signal 6
19 Execution timed out 1097 ms 296 KB Time limit exceeded
20 Execution timed out 1084 ms 304 KB Time limit exceeded
21 Execution timed out 1074 ms 212 KB Time limit exceeded
22 Execution timed out 1090 ms 212 KB Time limit exceeded
23 Execution timed out 1086 ms 212 KB Time limit exceeded
24 Execution timed out 1093 ms 212 KB Time limit exceeded
25 Execution timed out 1081 ms 212 KB Time limit exceeded
26 Execution timed out 1090 ms 212 KB Time limit exceeded
27 Execution timed out 1073 ms 212 KB Time limit exceeded
28 Execution timed out 1078 ms 212 KB Time limit exceeded
29 Execution timed out 1083 ms 212 KB Time limit exceeded
30 Execution timed out 1095 ms 212 KB Time limit exceeded
31 Execution timed out 1070 ms 212 KB Time limit exceeded
32 Execution timed out 1095 ms 212 KB Time limit exceeded
33 Execution timed out 1059 ms 336 KB Time limit exceeded
34 Execution timed out 1086 ms 212 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 212 KB Time limit exceeded
2 Execution timed out 1090 ms 224 KB Time limit exceeded
3 Runtime error 4 ms 552 KB Execution killed with signal 6
4 Execution timed out 1075 ms 212 KB Time limit exceeded
5 Execution timed out 1095 ms 212 KB Time limit exceeded
6 Execution timed out 1089 ms 212 KB Time limit exceeded
7 Runtime error 2 ms 468 KB Execution killed with signal 6
8 Execution timed out 1084 ms 212 KB Time limit exceeded
9 Runtime error 2 ms 468 KB Execution killed with signal 6
10 Execution timed out 1074 ms 212 KB Time limit exceeded
11 Execution timed out 1085 ms 212 KB Time limit exceeded
12 Execution timed out 1087 ms 212 KB Time limit exceeded
13 Execution timed out 1091 ms 212 KB Time limit exceeded
14 Runtime error 3 ms 468 KB Execution killed with signal 6
15 Execution timed out 1086 ms 212 KB Time limit exceeded
16 Execution timed out 1084 ms 212 KB Time limit exceeded
17 Execution timed out 1081 ms 212 KB Time limit exceeded
18 Execution timed out 1087 ms 212 KB Time limit exceeded
19 Execution timed out 1089 ms 212 KB Time limit exceeded
20 Runtime error 3 ms 468 KB Execution killed with signal 6
21 Execution timed out 1089 ms 212 KB Time limit exceeded
22 Execution timed out 1084 ms 212 KB Time limit exceeded
23 Execution timed out 1090 ms 212 KB Time limit exceeded
24 Execution timed out 1098 ms 212 KB Time limit exceeded
25 Execution timed out 1096 ms 212 KB Time limit exceeded
26 Execution timed out 1097 ms 300 KB Time limit exceeded
27 Execution timed out 1097 ms 212 KB Time limit exceeded
28 Execution timed out 1074 ms 212 KB Time limit exceeded
29 Execution timed out 1087 ms 212 KB Time limit exceeded
30 Execution timed out 1066 ms 300 KB Time limit exceeded
31 Execution timed out 1071 ms 288 KB Time limit exceeded
32 Execution timed out 1080 ms 212 KB Time limit exceeded
33 Execution timed out 1091 ms 300 KB Time limit exceeded
34 Execution timed out 1084 ms 212 KB Time limit exceeded
35 Execution timed out 1079 ms 340 KB Time limit exceeded
36 Execution timed out 1067 ms 212 KB Time limit exceeded
37 Execution timed out 1073 ms 212 KB Time limit exceeded
38 Execution timed out 1078 ms 212 KB Time limit exceeded
39 Execution timed out 1086 ms 212 KB Time limit exceeded