제출 #600684

#제출 시각아이디문제언어결과실행 시간메모리
600684enerelt14콤보 (IOI18_combo)C++14
5 / 100
1 ms336 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
string guess_sequence(int N){
    string ans, x;
    for (int i=0;i<N;i++){
        if (i==0){
            if (press("AB")>0){
                if (press("A")>0){
                    ans="A";
                    x="BXY";
                }
                else{
                    ans="B";
                    x="AXY";
                }
                continue;
            }
            if (press("X")>0){
                ans="X";
                x="ABY";
            }
            else{
                ans="Y";
                x="ABX";
            }
            continue;
        }
        if (N==1)return ans;
        if (i==N-1){
            if (press(ans+x[0])==N)return ans+x[0];
            if (press(ans+x[1])==N)return ans+x[1];
            return ans+x[2];
        }
        int y=press(ans+x[0]+ans+x[1]+x[0]+ans+x[1]+x[2]+ans+x[1]+x[1]);
        if (y==ans.size())ans+=x[2];
        if (y==ans.size()+1)ans+=x[0];
        if (y==ans.size()+2)ans+=x[1];
    }
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         if (y==ans.size())ans+=x[2];
      |             ~^~~~~~~~~~~~
combo.cpp:37:14: 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 (y==ans.size()+1)ans+=x[0];
      |             ~^~~~~~~~~~~~~~
combo.cpp:38:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if (y==ans.size()+2)ans+=x[1];
      |             ~^~~~~~~~~~~~~~
combo.cpp:5:12: warning: control reaches end of non-void function [-Wreturn-type]
    5 |     string ans, x;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...