제출 #439189

#제출 시각아이디문제언어결과실행 시간메모리
439189Idkwhoami콤보 (IOI18_combo)C++17
30 / 100
73 ms480 KiB
#include "bits/stdc++.h"
#include "combo.h"

using namespace std;


string guess_sequence(int N) {
    string ans = "Y";
    vector<string> tf = {"A", "B", "X"}, all = {"A", "B", "X", "Y"};
    for(auto t:tf){
        int x = press(t);
        if(x == 1) {
            ans = t;
            break;
        }
    }
    vector<string> possible;
    for(auto t:all){
        if(t != ans)possible.push_back(t);
    }
    

    string start = ans;
    if(N == 1)ans;

    while(ans.size() != N){

        string test1 = ans + possible[0] + ans + possible[1];

        int x = press(test1);
        if(x == ans.size()){
            ans = ans + possible[2];
        }
        else{
            x = press(ans + possible[0]);
            if(x == ans.size())ans = ans + possible[1];
            else ans = ans + possible[0];
        }
    }
    return ans;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:15: warning: statement has no effect [-Wunused-value]
   24 |     if(N == 1)ans;
      |               ^~~
combo.cpp:26:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     while(ans.size() != N){
      |           ~~~~~~~~~~~^~~~
combo.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if(x == ans.size()){
      |            ~~^~~~~~~~~~~~~
combo.cpp:36:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             if(x == ans.size())ans = ans + possible[1];
      |                ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...