제출 #138260

#제출 시각아이디문제언어결과실행 시간메모리
138260degelo콤보 (IOI18_combo)C++17
0 / 100
2 ms268 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
string st;
int np[2006];
/*int press(string n){
    int i=0;
    while(n[i]==st[i]){
        i++;
    }
    return i;
}*/
string guess_sequence(int n){
    string a[4];
    string s;
    int first;
    bool achou=false;
    for(int i=0;i<2000;i++){
        np[i]=-1;
    }
    a[0]="A",a[1]="B",a[2]="X",a[3]="Y";
    for(int i=0;i<3;i++){
        int prox;
        if(i==1||i==0) prox=1-i;
        else prox=5-i;
        if(!achou){
            int t=press(a[i]+a[prox]);
            if(t==1){
                achou=true;
                first=i;
                s+=a[i];
                np[2]=prox;
            }
            if(t==2){
                achou=true;
                s+=a[i];s+=a[prox];
                first=i;
            }
        }
    }
    if(!achou){
        s+=a[3];
        first=3;
    }
    int p1,p2;
    if(first==0||first==3){
        p1=1;
        p2=2;
    }
    else {
        p1=0;
        p2=3;
    }
    achou=false;
    for(int i=s.size();i<n;i++){
        int npode=1;
        for(int j=0;j<4;j++){
            if(!achou&&npode!=3&&j!=first){
                if(np[i]==j){
                    npode++;
                    continue;
                }
                int prox;
                if(p1==j) prox=p2;
                else prox=p1;
                int t=press(s+a[j]+a[prox]);
                if(t==s.size()+1){
                    np[s.size()+1]=prox;
                    s+=a[j];
                    achou=true;
                }
                else if(t==s.size()+2){
                    i++;
                    s+=a[j];s+=a[prox];
                    achou=true;
                }
                else npode++;
            }
            else if(npode==3&&i!=first&&!achou){
                s+=a[j];
                achou=true;
            }
        }
        achou=false;
    }
    return s;
}
/*int main()
{
    cin>>st;
    cout<<guess_sequence(st.size());



}*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:67:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |                 if(t==s.size()+1){
      |                    ~^~~~~~~~~~~~
combo.cpp:72:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                 else if(t==s.size()+2){
      |                         ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...