제출 #553228

#제출 시각아이디문제언어결과실행 시간메모리
553228sandry24콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

int press(std::string p);

string guess_string(int n){
    string temp = "";
    while(temp.size() != n){
        int gotten_points = 0;
        if(temp[0] != 'A' && !gotten_points){
            string temp2 = temp + "A";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }
        } 
        if(temp[0] != 'B' && !gotten_points){
            string temp2 = temp + "B";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
        if(temp[0] != 'X' && !gotten_points){
            string temp2 = temp + "X";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
        if(temp[0] != 'Y' && !gotten_points){
            string temp2 = temp + "Y";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
    }
    return temp;
}

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

combo.cpp: In function 'std::string guess_string(int)':
combo.cpp:16:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(temp.size() != n){
      |           ~~~~~~~~~~~~^~~~
combo.cpp:20:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:27:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:35:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:43:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc9tIP4p.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status