제출 #109147

#제출 시각아이디문제언어결과실행 시간메모리
109147kingfran1907콤보 (IOI18_combo)C++14
0 / 100
2 ms256 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;
const char koj[] = "ABXY";

string guess_sequence(int n) {
        string s;

        char ac = 'Z';
        for (int i = 0; i < 3; i++) {
                string tren; tren += koj[i];
                if (press(tren) == 1) ac = koj[i];
        }
        if (ac == 'Z') ac = 'Y';

        char a = 0, b = 0, c = 0;
        for (int i = 0; i < 4; i++) {
                if (koj[i] == ac) continue;

                if (a == 0) a = koj[i];
                else if (b == 0) b = koj[i];
                else c = koj[i];
        }

        s += ac;
        for (int i = 1; i < n; i++) {
                string query = s + a + s + b + c + s + b + b;
                
                int kol = press(query);
                if (kol == s.size()) s.push_back(c);
                else if (kol == s.size() + 1) s.push_back(a);
                else s.push_back(b);
        };
        return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:25: 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 (kol == s.size()) s.push_back(c);
      |                     ~~~~^~~~~~~~~~~
combo.cpp:32:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 else if (kol == s.size() + 1) s.push_back(a);
      |                          ~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...