답안 #932974

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
932974 2024-02-24T16:35:26 Z skyvn97 Martian DNA (IOI16_dna) C++14
11 / 100
25 ms 600 KB
#ifndef SKY
#include "dna.h"
#endif // SKY

#include <bits/stdc++.h>
using namespace std;

#ifdef SKY

string analyse(int, int);

struct Jury {
    static const int QUERY_LIMIT = 256;

    string s;
    int queryCount;

    void init(void) {
        int len = rand() % 10 + 1;
        s.clear();
        for (int i = 0; i < len; i++) s.push_back(rand() % 2 ? '0' : '1');

        queryCount = 0;
    }

    bool make_test(const string &p) {
        assert(++queryCount <= QUERY_LIMIT);

        if (p.size() > s.size()) return false;
        for (int i = 0; i <= s.size() - p.size(); i++) {
            bool ok = true;
            for (int j = 0; j < p.size(); j++) if (s[i + j] != p[j]) {
                ok = false; break;
            }
            if (ok) return true;
        }
        return false;
    }

    void process(void) {
        string r = analyse(s.size(), QUERY_LIMIT);
        assert(r == s);

        if (r != s) printf("Expected %s, received %s\n", s.c_str(), r.c_str());
        else printf("ACCEPTED after %d queries\n", queryCount);
    }
} jury;

bool make_test(string p) {
    return jury.make_test(p);
}

#endif // SKY

std::string analyse(int n, int t) {
    if (!make_test("1")) return string(n, '0');

    string res = "1";

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

    return res;
}

#ifdef SKY

int main(void) {
    for (int i = 0; i < 1000; i++) {
        jury.init();
        jury.process();
    }
    return 0;
}

#endif // SKY

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 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 436 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 440 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 436 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Incorrect 1 ms 348 KB Too many tests
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 436 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 600 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 596 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 436 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 440 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 428 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 440 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Incorrect 11 ms 344 KB Too many tests
23 Incorrect 19 ms 544 KB Too many tests
24 Incorrect 24 ms 524 KB Too many tests
25 Incorrect 25 ms 344 KB Too many tests
26 Incorrect 23 ms 348 KB Too many tests
27 Incorrect 7 ms 348 KB Too many tests
28 Incorrect 7 ms 348 KB Too many tests
29 Correct 0 ms 436 KB Output is correct
30 Incorrect 11 ms 440 KB Too many tests
31 Incorrect 11 ms 520 KB Too many tests
32 Correct 5 ms 348 KB Output is correct
33 Incorrect 13 ms 344 KB Too many tests
34 Incorrect 15 ms 348 KB Too many tests
35 Incorrect 11 ms 448 KB Too many tests
36 Incorrect 17 ms 344 KB Too many tests
37 Incorrect 16 ms 348 KB Too many tests
38 Incorrect 16 ms 476 KB Too many tests
39 Incorrect 14 ms 348 KB Too many tests