답안 #402447

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
402447 2021-05-11T17:18:58 Z Alma Martian DNA (IOI16_dna) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "dna.h"
using namespace std;

bool make_test (string s) {}

string analyse(int n, int t) {
    string p = "";
    while ((int)p.size() < n) {
        if (make_test(p + '0')) p += '0';
        else p += '1';
        if (make_test('0' + p)) p = '0' + p;
        else p = '1' + p;

        if ((int)p.size() > n || !make_test(p)) {
            int m = (int)p.size();
            if (make_test(p.substr(1, m-1))) {
                p = p.substr(1, m-1);
                while (true) {
                    if ((int)p.size() == n) return p;
                    if (make_test(p + '0')) p += '0';
                    else p += '1';
                }
            } else {
                p = p.substr(0, m-1);
                while (true) {
                    if ((int)p.size() == n) return p;
                    if (make_test('0' + p)) p = '0' + p;
                    else p = '1' + p;
                }
            }
        }
    } return p;
} 

Compilation message

dna.cpp: In function 'bool make_test(std::string)':
dna.cpp:5:28: warning: no return statement in function returning non-void [-Wreturn-type]
    5 | bool make_test (string s) {}
      |                            ^
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()) {
/usr/bin/ld: /tmp/ccXexYoB.o: in function `make_test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `make_test(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccuYHztA.o:dna.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status