제출 #849488

#제출 시각아이디문제언어결과실행 시간메모리
849488Bach21콤보 (IOI18_combo)C++14
30 / 100
20 ms1464 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
const int m=4;
string gue="ABXY";
string guess_sequence(int N) {
    string s="";
    string tmp="";
    int cnt=0;
    for (int i=0;i<N;i++) {
        bool check=0;
        for (int trie = 0; trie < gue.size()-1; trie++) {
            tmp = s;
            tmp += gue[trie];
            cnt = press(tmp);
            if (cnt > s.size()) {
                s+=gue[trie];
                if (i==0) gue.erase(gue.begin()+trie);
                check=1;
                break;
            }
        }
        if (!check)
        {
            s+=gue[gue.size()-1];
            if (i==0) gue.erase(gue.begin()+gue.size()-1);
        }
    }
    return s;
}
 

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for (int trie = 0; trie < gue.size()-1; trie++) {
      |                            ~~~~~^~~~~~~~~~~~~~
combo.cpp:16:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             if (cnt > s.size()) {
      |                 ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...