답안 #54746

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54746 2018-07-05T01:38:03 Z luciocf Martian DNA (IOI16_dna) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

int n;
string aux;

string get(int k)
{
    string ans = "";
    for (int i = 0; i < k; i++)
        ans += aux[i];
    return ans;
}

int busca(void)
{
    int ini = 1, fim = n;
    while (ini <= fim)
    {
        int mid = (ini+fim)>>1;

        if (make_test(get(mid))) ini = mid+1;
        else fim = mid-1;
    }
    return fim;
}

string analyse(int k, int t)
{
    n = k;

    int size = 1;
    string s = "";

    if (!make_test("0"))
    {
        for (int i = 1; i <= n; i++) s += "1";
        return s;
    }
    aux = "0";

    while (size < n)
    {
        if (make_test(aux+"0"))
            aux += "0";
        else
            aux += "1";
        size++;
    }
    int pos = busca();

    for (int i = 0; i < pos; i++) s += aux[i];

    aux = "";
    for (int i = 1; i <= n-pos; i++) aux += "1";
    return (aux+s);
}

Compilation message

dna.cpp: In function 'int busca()':
dna.cpp:23:13: error: 'make_test' was not declared in this scope
         if (make_test(get(mid))) ini = mid+1;
             ^~~~~~~~~
dna.cpp:23:13: note: suggested alternative: 'makedev'
         if (make_test(get(mid))) ini = mid+1;
             ^~~~~~~~~
             makedev
dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:36:10: error: 'make_test' was not declared in this scope
     if (!make_test("0"))
          ^~~~~~~~~
dna.cpp:36:10: note: suggested alternative: 'makedev'
     if (!make_test("0"))
          ^~~~~~~~~
          makedev
dna.cpp:45:13: error: 'make_test' was not declared in this scope
         if (make_test(aux+"0"))
             ^~~~~~~~~
dna.cpp:45:13: note: suggested alternative: 'makedev'
         if (make_test(aux+"0"))
             ^~~~~~~~~
             makedev
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < p.size(); i++) {
                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i <= ss.size(); i++) {
                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pr[i] == p.size()) {