제출 #770716

#제출 시각아이디문제언어결과실행 시간메모리
770716AtinaR콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
int press(string s)
{
    cout<<s<<endl;
    int k;
    cin>>k;
    return k;
}
std::string guess_sequence(int N)
{
    char first;
    int f=press("AB");
    if(f>=1)
    {
        f=press("A");
        if(f>=1)
        {
            first='A';
        }
        else
        {
            first='B';
        }
    }
    else
    {
        f=press("X");
        if(f>=1)
        {
            first='X';
        }
        else first='Y';
    }
    string res="";
    res+=first;
    char possible[3];
    if(first=='X')
    {
        possible[0]='A';
        possible[1]='B';
        possible[2]='Y';
    }
    else if(first=='Y')
    {
        possible[0]='A';
        possible[1]='B';
        possible[2]='X';
    }
    else if(first=='A')
    {
        possible[0]='X';
        possible[1]='B';
        possible[2]='Y';
    }
    else if(first=='B')
    {
        possible[0]='A';
        possible[1]='X';
        possible[2]='Y';
    }
    while((int)res.size()<N)
    {
        int tmp;
        string A=res+possible[0];
        string B=res+possible[1];
        string C=res+possible[2];
        tmp=press(A);
        if(tmp==(int)A.size())
        {
            res=A;
            continue;
        }
        tmp=press(B);
        if(tmp==(int)B.size())
        {
            res=B;
            continue;
        }
        res=C;
    }
    return res;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccDPBTtw.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccXJltfy.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status