제출 #430875

#제출 시각아이디문제언어결과실행 시간메모리
430875Belgutei콤보 (IOI18_combo)C++17
97 / 100
43 ms632 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;
int coin;
vector<char> v;

std::string guess_sequence(int N) {
    //
    p='A';
    coin=press(p);
    if(coin==0){
        p='B';
        coin=press(p); 
        if(coin==0){
            p='X';
            coin=press(p);
            if(coin==0) p='Y';
        }
    }
    char ch=p[0];
    if(ch!='A') v.pb('A');
    if(ch!='B') v.pb('B');
    if(ch!='X') v.pb('X');
    if(ch!='Y') v.pb('Y');
    for(int i=2; i<N; i++){
        tur=p+v[0]+p+v[1]+v[0]+p+v[1]+v[2]+p+v[1]+v[1];
        coin=press(tur);
        if(coin==p.size()){
            p+=v[2];
        }
        else{
            if(coin==p.size()+1){
                p+=v[0];
            }
            else{
                if(coin==p.size()+2) p+=v[1];
            }
        }
    }
    if(N==1) return p;
    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];
        return p;
    }
    else{
        p+=v[0];
        return p;
    }
    return p;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:16: 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(coin==p.size()){
      |            ~~~~^~~~~~~~~~
combo.cpp:41:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             if(coin==p.size()+1){
      |                ~~~~^~~~~~~~~~~~
combo.cpp:45:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |                 if(coin==p.size()+2) p+=v[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...