답안 #562976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
562976 2022-05-16T01:35:10 Z Spade1 Martian DNA (IOI16_dna) C++14
0 / 100
1000 ms 596 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+1)/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+1)/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()) {
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 468 KB Execution killed with signal 6
2 Runtime error 2 ms 496 KB Execution killed with signal 6
3 Runtime error 2 ms 468 KB Execution killed with signal 6
4 Runtime error 2 ms 468 KB Execution killed with signal 6
5 Runtime error 3 ms 468 KB Execution killed with signal 6
6 Runtime error 3 ms 468 KB Execution killed with signal 6
7 Runtime error 2 ms 468 KB Execution killed with signal 6
8 Runtime error 4 ms 468 KB Execution killed with signal 6
9 Runtime error 3 ms 468 KB Execution killed with signal 6
10 Runtime error 3 ms 468 KB Execution killed with signal 6
11 Runtime error 4 ms 468 KB Execution killed with signal 6
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 Runtime error 2 ms 468 KB Execution killed with signal 6
15 Runtime error 3 ms 468 KB Execution killed with signal 6
16 Runtime error 3 ms 496 KB Execution killed with signal 6
17 Runtime error 5 ms 468 KB Execution killed with signal 6
18 Runtime error 4 ms 468 KB Execution killed with signal 6
19 Runtime error 3 ms 468 KB Execution killed with signal 6
20 Runtime error 3 ms 468 KB Execution killed with signal 6
21 Runtime error 3 ms 500 KB Execution killed with signal 6
22 Runtime error 3 ms 552 KB Execution killed with signal 6
23 Runtime error 5 ms 468 KB Execution killed with signal 6
24 Runtime error 3 ms 468 KB Execution killed with signal 6
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 468 KB Execution killed with signal 6
2 Runtime error 4 ms 468 KB Execution killed with signal 6
3 Runtime error 3 ms 468 KB Execution killed with signal 6
4 Runtime error 2 ms 468 KB Execution killed with signal 6
5 Runtime error 3 ms 468 KB Execution killed with signal 6
6 Runtime error 3 ms 496 KB Execution killed with signal 6
7 Runtime error 2 ms 468 KB Execution killed with signal 6
8 Runtime error 2 ms 468 KB Execution killed with signal 6
9 Runtime error 2 ms 468 KB Execution killed with signal 6
10 Runtime error 3 ms 468 KB Execution killed with signal 6
11 Runtime error 2 ms 468 KB Execution killed with signal 6
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 Runtime error 4 ms 468 KB Execution killed with signal 6
15 Runtime error 5 ms 468 KB Execution killed with signal 6
16 Runtime error 3 ms 468 KB Execution killed with signal 6
17 Runtime error 3 ms 468 KB Execution killed with signal 6
18 Runtime error 3 ms 468 KB Execution killed with signal 6
19 Execution timed out 1086 ms 212 KB Time limit exceeded
20 Incorrect 1 ms 212 KB Wrong DNA
21 Incorrect 1 ms 212 KB Wrong DNA
22 Execution timed out 1093 ms 212 KB Time limit exceeded
23 Execution timed out 1092 ms 212 KB Time limit exceeded
24 Correct 1 ms 212 KB Output is correct
25 Execution timed out 1092 ms 296 KB Time limit exceeded
26 Execution timed out 1091 ms 212 KB Time limit exceeded
27 Incorrect 1 ms 296 KB Wrong DNA
28 Execution timed out 1080 ms 304 KB Time limit exceeded
29 Execution timed out 1083 ms 292 KB Time limit exceeded
30 Runtime error 3 ms 468 KB Execution killed with signal 6
31 Runtime error 2 ms 468 KB Execution killed with signal 6
32 Execution timed out 1093 ms 212 KB Time limit exceeded
33 Execution timed out 1088 ms 300 KB Time limit exceeded
34 Execution timed out 1091 ms 300 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 468 KB Execution killed with signal 6
2 Runtime error 2 ms 468 KB Execution killed with signal 6
3 Runtime error 2 ms 468 KB Execution killed with signal 6
4 Runtime error 3 ms 472 KB Execution killed with signal 6
5 Runtime error 3 ms 468 KB Execution killed with signal 6
6 Runtime error 3 ms 596 KB Execution killed with signal 6
7 Runtime error 3 ms 468 KB Execution killed with signal 6
8 Runtime error 2 ms 468 KB Execution killed with signal 6
9 Runtime error 2 ms 468 KB Execution killed with signal 6
10 Runtime error 2 ms 468 KB Execution killed with signal 6
11 Runtime error 2 ms 468 KB Execution killed with signal 6
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 Runtime error 2 ms 468 KB Execution killed with signal 6
15 Runtime error 3 ms 468 KB Execution killed with signal 6
16 Runtime error 2 ms 468 KB Execution killed with signal 6
17 Execution timed out 1085 ms 212 KB Time limit exceeded
18 Execution timed out 1072 ms 304 KB Time limit exceeded
19 Incorrect 1 ms 212 KB Wrong DNA
20 Runtime error 2 ms 468 KB Execution killed with signal 6
21 Correct 1 ms 212 KB Output is correct
22 Incorrect 12 ms 340 KB Wrong DNA
23 Execution timed out 1082 ms 340 KB Time limit exceeded
24 Execution timed out 1090 ms 340 KB Time limit exceeded
25 Incorrect 11 ms 352 KB Wrong DNA
26 Incorrect 13 ms 424 KB Wrong DNA
27 Execution timed out 1086 ms 300 KB Time limit exceeded
28 Execution timed out 1091 ms 384 KB Time limit exceeded
29 Incorrect 11 ms 340 KB Too many tests
30 Execution timed out 1091 ms 212 KB Time limit exceeded
31 Execution timed out 1088 ms 212 KB Time limit exceeded
32 Incorrect 13 ms 340 KB Wrong DNA
33 Incorrect 12 ms 400 KB Wrong DNA
34 Incorrect 8 ms 392 KB Wrong DNA
35 Execution timed out 1093 ms 340 KB Time limit exceeded
36 Execution timed out 1060 ms 212 KB Time limit exceeded
37 Execution timed out 1089 ms 212 KB Time limit exceeded
38 Execution timed out 1044 ms 212 KB Time limit exceeded
39 Execution timed out 1096 ms 340 KB Time limit exceeded