제출 #490771

#제출 시각아이디문제언어결과실행 시간메모리
490771CyberSleeperCombo (IOI18_combo)C++14
10 / 100
74 ms452 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string ch="ABXY";
int in;

string guess_sequence(int N) {
    bool pref=0;
    string S;
    for(auto i:ch){
        S=i;
        in=press(S);
        if(in)
            break;

    }
    while(!pref){
        pref=1;
        for(auto i:ch){
            string tmp=i+S;
            in=press(tmp);
            if(in==tmp.size()){
                pref=0;
                S=tmp;
                break;
            }
        }
    }
    while(S.size()<N){
        S=S+"0";
        for(auto i:ch){
            if(i==S[0])
                continue;
            S.back()=i;
            in=press(S);
            if(in==S.size())
                break;
        }
    }
    return S;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             if(in==tmp.size()){
      |                ~~^~~~~~~~~~~~
combo.cpp:30:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     while(S.size()<N){
      |           ~~~~~~~~^~
combo.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(in==S.size())
      |                ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...