제출 #553225

#제출 시각아이디문제언어결과실행 시간메모리
553225sandry24Combo (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

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:14:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |     while(temp.size() != n){
      |           ~~~~~~~~~~~~^~~~
combo.cpp:18:16: error: 'press' was not declared in this scope
   18 |             if(press(temp2) == temp2.size()){
      |                ^~~~~
combo.cpp:25:16: error: 'press' was not declared in this scope
   25 |             if(press(temp2) == temp2.size()){
      |                ^~~~~
combo.cpp:33:16: error: 'press' was not declared in this scope
   33 |             if(press(temp2) == temp2.size()){
      |                ^~~~~
combo.cpp:41:16: error: 'press' was not declared in this scope
   41 |             if(press(temp2) == temp2.size()){
      |                ^~~~~