제출 #160286

#제출 시각아이디문제언어결과실행 시간메모리
160286MarcoMendoza1콤보 (IOI18_combo)C++14
5 / 100
3 ms268 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string r="",aux;
char arr[4];

string guess_sequence(int n){
  int ax1=press("AB");
  if(ax1==1){
        arr[1]='X';
        arr[3]='Y';
        if(press("A")){
            arr[2]='B';
            r="A";

        }else{
            arr[2]='A';
            r="B";

        }

    }else if(ax1==0){
        arr[1]='A';
        arr[2]='B';
        if(press("X")){
            arr[3]='Y';
            r="X";

        }else{
            arr[3]='X';
            r="Y";

        }

    }else{
        arr[1]='X';
        arr[3]='Y';
        arr[2]='B';
        r="AB";


    }
    int ax;
    while(r.size()<(n-1)){
        aux=r+arr[2]+r+arr[1]+arr[1]+r+arr[1]+arr[2]+r+arr[1]+arr[3];
        ax=press(aux);
        if(ax==r.size()){
            r=r+arr[3];

        }else if(ax==(r.size()+1)){
            r=r+arr[2];

        }else{
            r=r+arr[1];

        }

    }

    if(press(r+arr[1]+r+arr[2])==n){
        if(press(r+arr[1])==n){
            return r+arr[1];

        }else{
            return r+arr[2];

        }

    }else{
        return r+arr[3];

    }

}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:46:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   46 |     while(r.size()<(n-1)){
      |           ~~~~~~~~^~~~~~
combo.cpp:49:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         if(ax==r.size()){
      |            ~~^~~~~~~~~~
combo.cpp:52:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         }else if(ax==(r.size()+1)){
      |                  ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...