제출 #701020

#제출 시각아이디문제언어결과실행 시간메모리
701020BobCompetitiveProgrammingCombo (IOI18_combo)C++14
10 / 100
63 ms572 KiB
#include <bits/stdc++.h>
using namespace std; using ll=long long;

/*
int press(string s){
    cout << " IN PRESS, ans with string s =  " << s << endl;
    ll ret; cin>>ret;
    return ret;
}
*/

int press(std::string p);

string guess_sequence(int N){
    string S = "", first;
    vector<string> buttons{"A", "B", "X", "Y"};
    for(auto& button : buttons)
        if(press(button))
            first = button, S += button;

    while(true){
        if(S.size() == N) 
            return S; 
        
        for(auto& button : buttons) 
            if(button != first && press(S + button) > S.size()) 
                S += button;
    }   
}

/*
int main(){
    guess_sequence(5);
}
*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |         if(S.size() == N)
      |            ~~~~~~~~~^~~~
combo.cpp:26:53: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             if(button != first && press(S + button) > S.size())
      |                                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...