제출 #430989

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

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

string p,tur;
vector<char> v;
int coin;

std::string guess_sequence(int N) {
    p="AB";
    coin=press(p);
    if(coin!=2){
        if(coin==1){
            p="A";
            coin=press(p);
            if(coin==0) p="B";
        }
        else{
            p="X";
            coin=press(p);
            if(coin==1) p="Y";
        }
    }
    if(p[0]!='A') v.pb('A');
    if(p[0]!='B') v.pb('B');
    if(p[0]!='X') v.pb('X');
    if(p[0]!='Y') v.pb('Y');
    int cnt=p.size();
    while(cnt<N-1){
        tur=p+v[0]+p+v[1]+v[0]+p+v[1]+v[1]+p+v[1]+v[2];
        coin=press(tur);
        if(coin==p.size()){
            p+=v[2];
        }
        else{
            if(coin==p.size()+1){
                p+=v[0];
            }
            else p+=v[1];
        }
        cnt++;
    }
    tur=p+v[0]+p+v[1];
    coin=press(tur);
    if(coin==p.size()){
        p+=v[2];
        return p;
    }
    tur=p+v[0];
    coin=press(tur);
    if(coin==p.size()){
        p+=v[1];
    }
    else p+=v[0];
    return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         if(coin==p.size()){
      |            ~~~~^~~~~~~~~~
combo.cpp:43:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             if(coin==p.size()+1){
      |                ~~~~^~~~~~~~~~~~
combo.cpp:52:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     if(coin==p.size()){
      |        ~~~~^~~~~~~~~~
combo.cpp:58:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     if(coin==p.size()){
      |        ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...